Type ITensorShape
Namespace tensorflow
Interfaces IEnumerable
Methods
- __getitem__
- assert_has_rank
- assert_same_rank
- concatenate
- most_specific_compatible_shape
- num_elements
- with_rank
- with_rank_at_least
- with_rank_at_most
Properties
Public instance methods
object __getitem__(object key)
Returns the specified piece of this RaggedTensor. Supports multidimensional indexing and slicing, with one restriction:
indexing into a ragged inner dimension is not allowed. This case is
problematic because the indicated value may exist in some rows but not
others. In such cases, it's not obvious whether we should (1) report an
IndexError; (2) use a default value; or (3) skip that value and return a
tensor with fewer rows than we started with. Following the guiding
principles of Python ("In the face of ambiguity, refuse the temptation to
guess"), we simply disallow this operation. Any dimensions added by `array_ops.newaxis` will be ragged if the following
dimension is ragged.
Parameters
-
object
key - Indicates which piece of the RaggedTensor to return, using standard
Python semantics (e.g., negative values index from the end). `key`
may have any of the following types: * `int` constant
* Scalar integer `Tensor`
* `slice` containing integer constants and/or scalar integer
`Tensor`s
* `Ellipsis`
*
tf.newaxis
* `tuple` containing any of the above (for multidimentional indexing)
Returns
-
object
- A `Tensor` or `RaggedTensor` object. Values that include at least one ragged dimension are returned as `RaggedTensor`. Values that include no ragged dimensions are returned as `Tensor`. See above for examples of expressions that return `Tensor`s vs `RaggedTensor`s.
object assert_has_rank(object rank)
object assert_same_rank(object other)
Raises an exception if `self` and `other` do not have compatible ranks.
Parameters
-
object
other - Another `TensorShape`.
object concatenate(object other)
Returns the concatenation of the dimension in `self` and `other`. *N.B.* If either `self` or `other` is completely unknown,
concatenation will discard information about the other shape. In
future, we might support concatenation that preserves this
information for use with slicing.
Parameters
-
object
other - Another `TensorShape`.
Returns
-
object
- A `TensorShape` whose dimensions are the concatenation of the dimensions in `self` and `other`.
object most_specific_compatible_shape(object other)
object num_elements()
Returns the total number of elements, or none for incomplete shapes.