我跟着this tutoriel将我自己训练的张量流模型导出到c ++,当我拨打freeze_graph
I tensorflow/core/common_runtime/gpu/gpu_device.cc:838] Creating TensorFlow device (/gpu:0) -> (device: 0, name: TITAN X (Pascal), pci bus id: 0000:03:00.0)
...
tensorflow.python.framework.errors.InvalidArgumentError: Cannot assign a device to node 'save/Const_1': Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available.
Colocation Debug Info:
Colocation group had the following types and devices:
Identity: CPU
Const: CPU
[[Node: save/Const_1 = Const[dtype=DT_STRING, value=Tensor<type: string shape: [] values: model>, _device="/device:GPU:0"]()]]
Caused by op u'save/Const_1', defined at:
...
Tensorflow检测到并使用了GPU:0 ,因此我不了解错误的来源。
有什么想法吗?
答案 0 :(得分:2)
错误意味着op save/Const_1
正试图置于GPU上,并且该节点没有GPU实现。事实上,Const
节点仅限CPU,并作为Graph对象的一部分存储,因此无法放置在GPU上。一种解决方法是使用allow_soft_placement=True
运行,或打开pbtxt
文件并手动删除该节点的device
行