2
votes

I'm following this tensorflow tutorial.

This is a basic question but I want to make sure I fully understand it. Are tensor dimensions described as row x column.

In this line:

x = tf.placeholder(tf.float32, [None, 784])

Does this mean that there are 784 columns and any number of rows?

https://www.tensorflow.org/versions/r1.3/get_started/mnist/beginners

2

2 Answers

0
votes

A rank 2 tensor is equivalent to a matrix in tensorflow, and the rows and columns can be thought of in the way that you have described. A typical use case for the None value for a dimension is to allow for a variable number of examples. In your case, x would be well-suited to holding any number of examples, each of which have 784 feature values.

0
votes

A Tensor can loosely be seen as an n-dimensional vector.

Hence,

  • tf.placeholder(tf.float32) => a scalar.
  • tf.placeholder(tf.float32, [3]) => a Vector.
  • tf.placeholder(tf.float32, [None, 784]) => a matrix (rows, columns).
  • tf.placeholder(tf.float32, [None, 28, 28, 3]) => a 3-Tensor (batch_size, row, columns, channels).

None means the Tensor can receive an arbitrary number.