arcoxia tom
arcoxia tom

Reputation: 1711

Are tensor dimensions row x column just like matrices?

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

Upvotes: 2

Views: 1807

Answers (2)

Ekaba Bisong
Ekaba Bisong

Reputation: 2982

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.

Upvotes: 1

djd
djd

Reputation: 696

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.

Upvotes: 0

Related Questions