Maybe my question is a bit naive, but I really didn\'t find anything in the tensorflow documentation.
I have a trained tensorflow model where the variables of it was
Use clear_devices
flag, ie
saver = tf.train.import_meta_graph("/tmp/graph.meta", clear_devices=True)
I'm using tensorflow 0.12 and clear_devices=True
and tf.device('/cpu:0')
was not working with me (saver.restore was still trying to assign variables to /gpu:0).
I really needed to force everything to /cpu:0 since I was loading several models which wouldn't fit in GPU memory anyways. Here are two alternatives to force everything to /cpu:0
os.environ['CUDA_VISIBLE_DEVICES']=''
tf.Session(config=tf.ConfigProto(device_count={"GPU": 0, "CPU": 1}))