How To Create Shuffled Batch List From Numpy Arrays To Feed Tensorflow Dictionnary
I am working on a classifier with Tensorflow. My input and output are numpy arrays with examples as rows and parameter as columns. My code is working correctly until now, and I cou
Solution 1:
I finally found how to create different batches randomly for each epoch. I post my solution as it may be useful for someone else. So here is the trick.
for epoch in range(0,2000):
permutation=np.random.permutation(input_size)
permutation=permutation[0:batch_size]
batch=[train_set[permutation],train_label[permutation]]
sess.run(train_step,feed_dict={X:batch[0],Yreal:batch[1]})
It may not be the sexiest way, but it's working. We have a random list (permutation) created at each epoch from which we extract our batches. Each batch is then fed to tensorflow.
Post a Comment for "How To Create Shuffled Batch List From Numpy Arrays To Feed Tensorflow Dictionnary"