Cannot assign a device to node
<p>I followed <a href="https://medium.com/@hamedmp/exporting-trained-tensorflow-models-to-c-the-right-way-cf24b609d183#.qajf9shah" rel="nofollow">this tutoriel</a> to export my own trained tensorflow model to c++ and I got errors when I call <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py#L70" rel="nofollow"><code>freeze_graph</code></a> </p>

<pre><code>I tensorflow/core/common_runtime/gpu/gpu_device.cc:838] Creating TensorFlow device (/gpu:0) -&gt; (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&lt;type: string shape: [] values: model&gt;, _device="/device:GPU:0"]()]]
Caused by op u'save/Const_1', defined at:
...
</code></pre>

<p><em>GPU:0</em> is detected and usable by Tensorflow, so I don't understand from where the error comes from.</p>

<p>Any idea ?</p>

<p>The error means op <code>save/Const_1</code> is trying to get placed on GPU, and there's no GPU implementation of that node. In fact <code>Const</code> nodes are CPU only and are stored as part of Graph object, so it can't be placed on GPU. One work-around is to run with <code>allow_soft_placement=True</code>, or to open the <code>pbtxt</code> file and manually remove the <code>device</code> line for that node</p>

python tensorflow