If I define a tf placeholder as:
tf.placeholder("float", [None, 10])
what does the None
do? What is the linear algebra interpretation of this? A horizontal vector?
“None” tells that any batch size will be accepted. Set to None, then the bs is not bounded by a specific number. Params means each layer's trainable and non-trainable parameters.
Partially-known shape: has a known number of dimensions, and an unknown size for one or more dimension. e.g. TensorShape([None, 256]) Unknown shape: has an unknown number of dimensions, and an unknown size in all dimensions. e.g. TensorShape(None)
The shape of a tensor is the number of elements in each dimension. TensorFlow automatically infers shapes during graph construction. These inferred shapes might have known or unknown rank. If the rank is known, the sizes of each dimension might be known or unknown.
What is a Tensor? Tensorflow's name is directly derived from its core framework: Tensor. In Tensorflow, all the computations involve tensors. A tensor is a vector or matrix of n-dimensions that represents all types of data.
The shape of the data is the dimensionality of the matrix or array. A tensor can be originated from the input data or the result of a computation. In TensorFlow, all the operations are conducted inside a graph. The graph is a set of computation that takes place successively. Each operation is called an op node and are connected to each other.
A tensor of dimension 1 can be created as follow: You can notice the TensorFlow shape is only composed of 1 column. To create an array of 2 tensor dimensions, you need to close the brackets after each row. Check the Keras Tensor shape example below
This article will guide you through the concept of tensor’s shape in both its variants: static and dynamic. Every tensor has a name, a type, a rank and a shape.
A None
value in the shape of a tensor means that the tensor can be of any size (large than or equal to 1) in that dimension. E.g., for the tf.placeholder
you defined in your question, you could pass a arrays with shapes like
[1234, 10]
[10, 10]
[1, 10]
but not an array of shape [10,]
(i.e. a vector).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With