Search code examples
pythontensorflowdeep-learningshapescomputation-graph

Tensorflow tf.placeholder with shape = []


I am looking at a Tensorflow code that has learning rate input to the graph using placeholder with shape = [], as below:

self.lr_placeholder = tf.placeholder(dtype=tf.float32, shape=[])

I looked at the official documentation page of Tensorflow (https://www.tensorflow.org/api_docs/python/tf/placeholder) to understand what would shape=[] mean, but could not get an explanation for the shape set to empty list. If someone can explain what does this mean.


Solution

  • its rank is 0, i.e. A 0-D tensor. A scalar. https://www.tensorflow.org/guide/tensors#shape