Run tensorflow on CPU

I've got a model, which is trained on gpu. Obviously I've installed tensorflow-gpu, but can I run my model on cpu?

tensorflowgpucpu
3 votesLP185.00
1 Answers
JW229.00
3

Just change the environment variable 

import os

os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
Reply
JW229.00
1

You can also do it with tensorflow python api

config = tf.ConfigProto(device_count = {'GPU': 0})
sess = tf.Session(config=config)
Couldn't find what you were looking for?and we will find an expert to answer.
How helpful was this page?