andy
andy

Reputation: 2181

why not use tensor or tf.data in tensorflow official tutorial?

I fond the example just use numpy array as input(https://www.tensorflow.org/tutorials/keras/classification).

Why not change numpy array to tensorflow tensor or tf.data? If both are ok, why need tensorflow tensor?

Upvotes: 1

Views: 38

Answers (1)

Rishabh Sahrawat
Rishabh Sahrawat

Reputation: 2507

You can use tf.data and based on my experience it is better to use it with TF, although it is a bit complicated. Let's say you have a large amount of dataset that might be difficult to fit into the memory (RAM), with Numpy Arrays it will try to store it into the memory during training, so complete data at once, however, with tf.data, you can use the same amount of data for training but now only the data that is currently being used for training (such a batch) will be stored in the memory. This can let you use GBs of data without running out of memory errors. This is the major difference between them, I would say. You can read more here.

Upvotes: 1

Related Questions