转自: https://www.jianshu.com/p/2fad8d3b567b
使用tensorflow c++ 调用Python 模型时出现
terminate called after throwing an instance of 'std::runtime_error'
what(): Error creating graph: Invalid argument: Cannot assign a device for operation Equal: {{node Equal}}was explicitly assigned to /device:GPU:1 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device. The requested device appears to be a GPU, but CUDA is not enabled.
[[Equal]]
大致意思就是我们将程序安排在GPU上跑,但是目前可用的设备仅有CPU!不应该啊,安装的是GPU版本的tensorflow啊,而且也成功的跑了试验程序啊!到底是什么个情况,这时候最好的办法就是去查看显卡显存的使用情况!
在终端输入
nvidia-smi
配置好cuda的环境变量
然后
sudo ldconfig