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`. out
(input, out_type=dtypes.int32, name=None)
| 397 | |
| 398 | @tf_export("shape", v1=[]) |
| 399 | def shape_v2(input, out_type=dtypes.int32, name=None): |
| 400 | # pylint: disable=redefined-builtin |
| 401 | """Returns the shape of a tensor. |
| 402 | |
| 403 | This operation returns a 1-D integer tensor representing the shape of `input`. |
| 404 | |
| 405 | For example: |
| 406 | |
| 407 | ```python |
| 408 | t = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]) |
| 409 | tf.shape(t) # [2, 2, 3] |
| 410 | ``` |
| 411 | |
| 412 | Args: |
| 413 | input: A `Tensor` or `SparseTensor`. |
| 414 | out_type: (Optional) The specified output type of the operation (`int32` or |
| 415 | `int64`). Defaults to `tf.int32`. |
| 416 | name: A name for the operation (optional). |
| 417 | |
| 418 | Returns: |
| 419 | A `Tensor` of type `out_type`. |
| 420 | """ |
| 421 | return shape(input, name, out_type) |
| 422 | |
| 423 | |
| 424 | @tf_export(v1=["shape"]) |