fast-style-transfer icon indicating copy to clipboard operation
fast-style-transfer copied to clipboard

Codes only Training on CPU

Open JangminSon opened this issue 5 years ago • 1 comments

I have question about codes In src/optimize.py,

with tf.Graph().as_default(), tf.device('/cpu:0'), tf.Session() as sess:

I Thought it is meant to training on the CPU (I mean using cpu). And if I run this code, It only use GPU Memory and doesn't use its processing power. and If I trying to change cpu into gpu, It occurs error below.

tensorflow.python.framework.errors_imp.InvalidArgumentError: Cannot assign a device for operation ‘save/SaveV2’: Could not satisfy explicit device specification ‘/device:GPU:0’ because no supported kernel for GPU devices is available

So I erased the 'tf.device ' part and It worked fine. Am I misunderstood something?

I'm using TF version - 1.4 Python 2.7.12 CUDA 8.0 with cudnn

I hope it would help someone with this error like me.

JangminSon avatar Aug 05 '18 09:08 JangminSon

That line of code line 31 is for preprocessing data in optimize.py. It does not affect training, it only loads files into memory.

line 42 with tf.Graph().as_default(), tf.Session() as sess: is where training occurs, and it should use your GPU (if you have one) by default.

JEF1056 avatar Oct 02 '18 22:10 JEF1056