<p dir="auto">Please go to Stack Overflow for help and support:</p>
<p dir="auto"><a href="https://stackoverflow.com/questions/tagged/tensorflow" rel="nofollow">https://stackoverflow.com/questions/tagged/tensorflow</a></p>
<p dir="auto">If you open a GitHub issue, here is our policy:</p>
<ol dir="auto">
<li>It must be a bug or a feature request.</li>
<li>The form below must be filled out.</li>
<li>It shouldn't be a TensorBoard issue. Those go <a href="https://github.com/tensorflow/tensorboard/issues">here</a>.</li>
</ol>
<p dir="auto"><strong>Here's why we have that policy</strong>: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.</p>
<hr>
<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: YES</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>:<br>
Generating Tensorflow model:  Ubuntu 16.04 LTS (GNU/Linux 4.4.0-91-generic x86_64)<br>
Load Tensorflow model: macOS 10.12 Sierra</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: TensorFlow is installed from source</li>
<li><strong>TensorFlow version (use command below)</strong>: TensorFlow version 1.2.0</li>
<li><strong>Python version</strong>: Python version 3.5</li>
<li><strong>Bazel version (if compiling from source)</strong>: Bazel version  0.5.3</li>
<li><strong>CUDA/cuDNN version</strong>: None</li>
<li><strong>GPU model and memory</strong>: NA</li>
<li><strong>Exact command to reproduce</strong>:</li>
</ul>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">Error happen when call "status = session_t-&gt;Create(graph)"</p>
<p dir="auto">error message:<br>
2017-08-16 13:22:27.692781+0800 CameraExample[6322:2753781] Error adding graph to session: No OpKernel was registered to support Op 'RandomUniform' with these attrs.  Registered devices: [CPU], Registered kernels:<br>
</p>
<h3 dir="auto">Source code / logs</h3>
<h2 dir="auto">Export models as *.pb file: (In python)<br>
self.saver.save(self.sess, self.my_path_to_model + "model.ckpt", global_step=i)<br>
output_graph_def = tf.graph_util.convert_variables_to_constants(self.sess,self.sess.graph_def,output_node_names=['models_simple/y_conv'])<br>
with tf.gfile.FastGFile(self.my_path_to_model+ 'graph.pb', mode = 'wb') as f:<br>
f.write(output_graph_def.SerializeToString())</h2>
<p dir="auto">IOS:</p>
<h2 dir="auto">use the following operations to process exported model</h2>
<p dir="auto">#Call freeze_graph, synthesize graph.pb and CKPT, generate frozen.pb<br>
bazel-bin/tensorflow/python/tools/freeze_graph <br>
--input_graph=XXXX/graph.pb <br>
--input_checkpoint=XXXX/model.ckpt-0 <br>
--output_node_names=models_simple/Placeholder,models_simple/y_conv <br>
--input_binary <br>
--output_graph=XXXX/frozen.pb</p>
<p dir="auto">#Call optimize_for_inference, reduce the operation, replace the calculation can not run in the iOS version, generate inference.pb<br>
bazel-bin/tensorflow/python/tools/optimize_for_inference <br>
--input=XXXX/frozen.pb <br>
--output=XXXX/inference.pb <br>
--input_names=models_simple/Placeholder <br>
--output_names=models_simple/y_conv <br>
--frozen_graph=True</p>
<h2 dir="auto">#Call quantize_graph to further optimize the graph, generate rounded_graph.pb<br>
bazel-bin/tensorflow/tools/quantization/quantize_graph <br>
--input=XXXX/inference.pb <br>
--output=XXXX/rounded_graph.pb <br>
--output_node_names=models_simple/y_conv <br>
--mode=weights_rounded</h2>
<p dir="auto">Then, execute the following code, (BOOL)loadGraphFromPath executed successfully, but error raised at "status = session_t-&gt;Create(graph)"</p>
<ul dir="auto">
<li>
<p dir="auto">(BOOL)loadGraphFromPath:(NSString *)path<br>
{<br>
auto status = ReadBinaryProto(tensorflow::Env::Default(), path.fileSystemRepresentation, &amp;graph);<br>
if (!status.ok()) {<br>
NSLog(@"Error reading graph: %s", status.error_message().c_str());<br>
return NO;<br>
}</p>
<p dir="auto">// This prints out the names of the nodes in the graph.<br>
auto nodeCount = graph.node_size();<br>
NSLog(@"Node count: %d", nodeCount);<br>
for (auto i = 0; i &lt; nodeCount; ++i) {<br>
auto node = graph.node(i);<br>
NSLog(@"Node %d: %s '%s'", i, node.op().c_str(), node.name().c_str());<br>
}</p>
<p dir="auto">return YES;<br>
}</p>
</li>
</ul>
<p dir="auto">create tf session:</p>
<ul dir="auto">
<li>
<p dir="auto">(BOOL)createSession<br>
{<br>
tensorflow::SessionOptions options;<br>
auto status = tensorflow::NewSession(options, &amp;session_t);<br>
if (!status.ok()) {<br>
NSLog(@"Error creating session: %s", status.error_message().c_str());<br>
return NO;<br>
}</p>
<p dir="auto">status = session_t-&gt;Create(graph);<br>
if (!status.ok()) {<br>
// error<br>
NSLog(@"Error adding graph to session: %s", status.error_message().c_str());<br>
return NO;<br>
}</p>
<p dir="auto">return YES;<br>
}</p>
</li>
</ul>
<p dir="auto">error message:<br>
2017-08-16 13:22:27.692781+0800 CameraExample[6322:2753781] Error adding graph to session: No OpKernel was registered to support Op 'RandomUniform' with these attrs.  Registered devices: [CPU], Registered kernels:<br>
</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" [[Node: dropout/random_uniform/RandomUniform = RandomUniform[T=DT_INT32, dtype=DT_FLOAT, seed=87654321, seed2=24](dropout/Shape)]]"><pre class="notranslate"><code class="notranslate"> [[Node: dropout/random_uniform/RandomUniform = RandomUniform[T=DT_INT32, dtype=DT_FLOAT, seed=87654321, seed2=24](dropout/Shape)]]
</code></pre></div>
<h1 dir="auto">It seems that RandomUniform was not supported on iOS , but when I called freeze_graph, those which are not supported on iOS should be deleted. What can I do for this problem?</h1>
<p dir="auto">Hi!</p>
<p dir="auto">Im working with the python wrapper for tensorflow. Is there any intentions of implement similar wrappers for the R languages?</p>