In these cases, using tf.Tensor.shape will return more informative results.
a.shapeTensorShape([None,None,10])
tf.shape and Tensor.shape should be identical in eager mode. Within
tf.function or within a compat.v1 context, not all dimensions may be
known until execution time.
Args
input
A Tensor or SparseTensor.
out_type
(Optional) The specified output type of the operation (int32 or
int64). Defaults to tf.int32.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["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.2.0/tensorflow/python/ops/array_ops.py#L533-L576) |\n\nReturns the shape of a tensor. \n\n tf.shape(\n input, out_type=tf.dtypes.int32, name=None\n )\n\nSee also [`tf.size`](../tf/size).\n\nThis operation returns a 1-D integer tensor representing the shape of `input`.\nThis represents the minimal set of known information at definition time.\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[`tf.shape`](../tf/shape) and [`Tensor.shape`](../tf/Tensor#shape) should be identical in eager mode. Within\n[`tf.function`](../tf/function) or within a [`compat.v1`](../tf/compat/v1) context, not all dimensions may be\nknown until execution time.\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"]]