Lesson 9: neural-sr: train_on_batch doesn't use the gpu?


I am just getting the neural super-resolution example to work and noticed that Keras is not using the GPU for running the loop around ``m_sr.train_on_batch([lr[:bs], hr[:bs]], targ)’’ in the train function. Still, when I setup the notebook on top it says I should be using the tensorflow backend:

Using TensorFlow backend.

def train(bs, niter=10):
    targ = np.zeros((bs, 1))
    bc = BcolzArrayIterator(arr_hr, arr_lr, batch_size=bs)
    for i in range(niter):
        hr,lr = next(bc)
        m_sr.train_on_batch([lr[:bs], hr[:bs]], targ)

Any idea why it is not running on the GPU? Do my batches maybe use too much memory so they cannot fit on the GPU?


maybe you didn’t install the tensorflow-gpu version?

1 Like

@justinho Yeah, you are right. I figured it out now, thanks!