Returns the shape of a tensor. This operation returns a 1-D integer tensor representing the shape of `input`. For example: ```python t = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]) tf.shape(t) # [2, 2, 3] ``` Args: input: A `Tensor` or `SparseTensor`. nam
(input, name=None, out_type=dtypes.int32)
| 423 | |
| 424 | @tf_export(v1=["shape"]) |
| 425 | def shape(input, name=None, out_type=dtypes.int32): |
| 426 | # pylint: disable=redefined-builtin |
| 427 | """Returns the shape of a tensor. |
| 428 | |
| 429 | This operation returns a 1-D integer tensor representing the shape of `input`. |
| 430 | |
| 431 | For example: |
| 432 | |
| 433 | ```python |
| 434 | t = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]) |
| 435 | tf.shape(t) # [2, 2, 3] |
| 436 | ``` |
| 437 | |
| 438 | Args: |
| 439 | input: A `Tensor` or `SparseTensor`. |
| 440 | name: A name for the operation (optional). |
| 441 | out_type: (Optional) The specified output type of the operation (`int32` or |
| 442 | `int64`). Defaults to `tf.int32`. |
| 443 | |
| 444 | Returns: |
| 445 | A `Tensor` of type `out_type`. |
| 446 | """ |
| 447 | return shape_internal(input, name, optimize=True, out_type=out_type) |
| 448 | |
| 449 | |
| 450 | def shape_internal(input, name=None, optimize=True, out_type=dtypes.int32): |
no test coverage detected