infocusp / tf_cnnvis

CNN visualization tool in TensorFlow
MIT License
781 stars 209 forks source link

Cannot assign a device for operation error #14

Closed cuihenggang closed 7 years ago

cuihenggang commented 7 years ago

Hi,

I was running activation_visualization on my graph checkpoint, and it throws this error. Do you know why?

InvalidArgumentError: Cannot assign a device for operation 'fake_var_3': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/cpu:0 ]. Make sure the device specification refers to a valid device. [[Node: fake_var_3 = VariableV2[container="", dtype=DT_FLOAT, shape=[1], shared_name="", _device="/device:GPU:0"]()]]

Maybe allow_soft_placement should be set to True when creating the TF session?

BhagyeshVikani commented 7 years ago

Hello @cuihenggang,

Thank You. Yes, you are right. Setting allow_soft_placement to True while creating the TF sesstion will solve the issue. We make the changes.

cuihenggang commented 7 years ago

I just find this issue can be solved if I just load the frozen graph rather than the graph checkpoints. Maybe allow_soft_placement is not necessarily in this case. Thank you!

BhagyeshVikani commented 7 years ago

Thank You @cuihenggang.