Reading numpy matrix in batches in Tensorflow

Viewed 4526

I am trying to run some regression models on GPU. While I get a very low GPU utilization upto 20%. After going through the code,

 for i in range(epochs):
    rand_index = np.random.choice(args.train_pr,
        size=args.batch_size)
    rand_x = X_train[rand_index]
    rand_y = Y_train[rand_index]

I use these three lines for selecting a random batch for each iteration. So, I wanted to ask when the training is going on, can I ready up one more batch for the next iteration?

I am working on a regression problem and not a classification problem. I have already seen threading in Tensorflow but found the examples only for images and there's no example for a big matrix of size 100000X1000 which is used for training.

2 Answers
Related