Isaac
Isaac

Reputation: 13

Difference between shuffle_batch() and batch() in tensorflow

I'm using tf.train.shuffle_batch() and tf.train.batch() to read a .record file with two classes and three examples per class. If I want two batches of three examples, I put num_epochs = 1 in string_input_producer so I'll get two batches of three examples of each but both functions return two shuffled batches every time I call them.

What is the difference between this two functions?

Thanks!

Upvotes: 0

Views: 386

Answers (1)

VS_FF
VS_FF

Reputation: 2363

tf._train.shuffle_batch() will return records in random order, while tf.train.batch() will return them in sequential order from your source. One or the other may be more helpful depending on what you are trying to accomplish. I'd say go with shuffle_batch because it adds extra randomization to the learning process, but think first of what makes sense given your task.

Upvotes: 1

Related Questions