[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.shape\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 1 version](/versions/r1.15/api_docs/python/tf/shape) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/array_ops.py#L483-L519) |\n\nReturns the shape of a tensor. \n\n tf.shape(\n input, out_type=tf.dtypes.int32, name=None\n )\n\nThis operation returns a 1-D integer tensor representing the shape of `input`.\n\n#### For example:\n\n t = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]])\n tf.shape(t)\n \u003ctf.Tensor: shape=(3,), dtype=int32, numpy=array([2, 2, 3], dtype=int32)\u003e\n tf.shape(t).numpy()\n array([2, 2, 3], dtype=int32)\n\n**Note:** When using symbolic tensors, such as when using the Keras functional API, tf.shape() will return the shape of the symbolic tensor. \n\n a = tf.keras.layers.Input((None, 10))\n tf.shape(a)\n \u003ctf.Tensor ... shape=(3,) dtype=int32\u003e\n\nIn these cases, using [`tf.Tensor.shape`](../tf/Tensor#shape) will return more informative results. \n\n a.shape\n TensorShape([None, None, 10])\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------|--------------------------------------------------------------------------------------------------------------------|\n| `input` | A `Tensor` or `SparseTensor`. |\n| `out_type` | (Optional) The specified output type of the operation (`int32` or `int64`). Defaults to [`tf.int32`](../tf#int32). |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor` of type `out_type`. ||\n\n\u003cbr /\u003e"]]