itzik Ben Shabat
itzik Ben Shabat

Reputation: 927

How to execute multiple training operation on the same batch using tf.data dataset

I want to implement the code available here using a tf.data dataset and iterator (adversarial autoencoder).

My question is how to use the same batch for multiple training ops?

I need to perform three different training operations on the same batch, however, if I use the tf.data iterator, it does not work on the same batch but on consecutive ones.

Upvotes: 1

Views: 185

Answers (1)

Ujjwal
Ujjwal

Reputation: 208

Suppose data = db_iter.get_next(), where db_iter is the iterator you are using from tf.data.

I suppose you are traning the 3 ops in 3 different sess.run statements. In that case they will all use 3 different batches as data will be evaluated 3 times.

The fact is that, if the input to each of the three training ops are provided from data as defined above, and run within each sess.run, they will all use the same batch.

Upvotes: 1

Related Questions