<p dir="auto">I am using exporter from tensorflow.contrib.session_bundle to save out my model:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="x = tf.placeholder(tf.float32, (None,) + (100, 200) + (1,))
....
saver = tf_saver.Saver(sharded=True)
model_exporter = exporter.Exporter(saver)
model_exporter.init(
    sess.graph.as_graph_def(),
    named_graph_signatures={
        'inputs': exporter.generic_signature({'images': x}),
        'outputs': exporter.generic_signature({'classes': y})})"><pre class="notranslate"><code class="notranslate">x = tf.placeholder(tf.float32, (None,) + (100, 200) + (1,))
....
saver = tf_saver.Saver(sharded=True)
model_exporter = exporter.Exporter(saver)
model_exporter.init(
    sess.graph.as_graph_def(),
    named_graph_signatures={
        'inputs': exporter.generic_signature({'images': x}),
        'outputs': exporter.generic_signature({'classes': y})})
</code></pre></div>
<p dir="auto">and then I load the model back in (session_bundle from tensorflow.contrib.session_bundle):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sess, meta_graph_def = session_bundle.load_session_bundle_from_path(input)"><pre class="notranslate"><code class="notranslate">sess, meta_graph_def = session_bundle.load_session_bundle_from_path(input)
</code></pre></div>
<p dir="auto">However when I inspect the Placeholder tensor corresponding to the input x, I see no shape information:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; sess.graph.get_tensor_by_name(input_name)
&lt;tf.Tensor 'Placeholder:0' shape=&lt;unknown&gt; dtype=float32&gt;"><pre class="notranslate"><code class="notranslate">&gt; sess.graph.get_tensor_by_name(input_name)
&lt;tf.Tensor 'Placeholder:0' shape=&lt;unknown&gt; dtype=float32&gt;
</code></pre></div>
<p dir="auto">Is this by design or is there some bug causing the shape to be lost?</p>
<h3 dir="auto">What related GitHub issues or StackOverflow threads have you found by searching the web for your problem?</h3>
<p dir="auto">Report from SO: <a href="http://stackoverflow.com/questions/40733752/exported-tensorflow-model-not-preserving-placeholder-shape" rel="nofollow">http://stackoverflow.com/questions/40733752/exported-tensorflow-model-not-preserving-placeholder-shape</a></p>
<h3 dir="auto">Environment info</h3>
<p dir="auto">Operating System:<br>
Using <code class="notranslate">gcr.io/tensorflow/tensorflow:latest-devel-gpu</code> docker iamge</p>
<p dir="auto">Installed version of CUDA and cuDNN:<br>
(please attach the output of <code class="notranslate">ls -l /path/to/cuda/lib/libcud*</code>):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# ls -al /usr/local/cuda/lib64/libcud*
-rw-r--r-- 1 root root    558720 Sep 14 23:02 /usr/local/cuda/lib64/libcudadevrt.a
lrwxrwxrwx 1 root root        16 Sep 14 23:05 /usr/local/cuda/lib64/libcudart.so -&gt; libcudart.so.8.0
lrwxrwxrwx 1 root root        19 Sep 14 23:05 /usr/local/cuda/lib64/libcudart.so.8.0 -&gt; libcudart.so.8.0.44
-rw-r--r-- 1 root root    415432 Sep 14 23:02 /usr/local/cuda/lib64/libcudart.so.8.0.44
-rw-r--r-- 1 root root    775162 Sep 14 23:02 /usr/local/cuda/lib64/libcudart_static.a
lrwxrwxrwx 1 1000 users       13 Jul 27 05:55 /usr/local/cuda/lib64/libcudnn.so -&gt; libcudnn.so.5
lrwxrwxrwx 1 1000 users       17 Jul 27 05:55 /usr/local/cuda/lib64/libcudnn.so.5 -&gt; libcudnn.so.5.1.5
-rwxrwxr-x 1 1000 users 79337624 Jul 27 05:53 /usr/local/cuda/lib64/libcudnn.so.5.1.5
-rw-rw-r-- 1 1000 users 69756172 Jul 27 05:53 /usr/local/cuda/lib64/libcudnn_static.a"><pre class="notranslate"><code class="notranslate"># ls -al /usr/local/cuda/lib64/libcud*
-rw-r--r-- 1 root root    558720 Sep 14 23:02 /usr/local/cuda/lib64/libcudadevrt.a
lrwxrwxrwx 1 root root        16 Sep 14 23:05 /usr/local/cuda/lib64/libcudart.so -&gt; libcudart.so.8.0
lrwxrwxrwx 1 root root        19 Sep 14 23:05 /usr/local/cuda/lib64/libcudart.so.8.0 -&gt; libcudart.so.8.0.44
-rw-r--r-- 1 root root    415432 Sep 14 23:02 /usr/local/cuda/lib64/libcudart.so.8.0.44
-rw-r--r-- 1 root root    775162 Sep 14 23:02 /usr/local/cuda/lib64/libcudart_static.a
lrwxrwxrwx 1 1000 users       13 Jul 27 05:55 /usr/local/cuda/lib64/libcudnn.so -&gt; libcudnn.so.5
lrwxrwxrwx 1 1000 users       17 Jul 27 05:55 /usr/local/cuda/lib64/libcudnn.so.5 -&gt; libcudnn.so.5.1.5
-rwxrwxr-x 1 1000 users 79337624 Jul 27 05:53 /usr/local/cuda/lib64/libcudnn.so.5.1.5
-rw-rw-r-- 1 1000 users 69756172 Jul 27 05:53 /usr/local/cuda/lib64/libcudnn_static.a
</code></pre></div>
<p dir="auto">If installed from source, provide</p>
<ol dir="auto">
<li>The commit hash (<code class="notranslate">git rev-parse HEAD</code>)</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="4d924e796368163eff11a8151e8505715345f58d"><pre class="notranslate"><code class="notranslate">4d924e796368163eff11a8151e8505715345f58d
</code></pre></div>
<ol start="2" dir="auto">
<li>The output of <code class="notranslate">bazel version</code></li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# bazel version
INFO: Reading 'startup' options from /root/.bazelrc: --batch
Extracting Bazel installation...
Build label: 0.3.2
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Oct 7 17:25:10 2016 (1475861110)
Build timestamp: 1475861110
Build timestamp as int: 1475861110"><pre class="notranslate"><code class="notranslate"># bazel version
INFO: Reading 'startup' options from /root/.bazelrc: --batch
Extracting Bazel installation...
Build label: 0.3.2
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Oct 7 17:25:10 2016 (1475861110)
Build timestamp: 1475861110
Build timestamp as int: 1475861110
</code></pre></div>
<p dir="auto">I am following along from this point: <a href="https://www.tensorflow.org/get_started/get_started#basic_usage" rel="nofollow">https://www.tensorflow.org/get_started/get_started#basic_usage</a><br>
It is a linear regression example.</p>
<p dir="auto">I have approached this execution from two angles:</p>
<p dir="auto">Angle 1: Running python and copying one line at a time.<br>
When run this line:  estimator = <code class="notranslate">tf.contrib.learn.LinearRegressor(feature_columns=features)</code></p>
<p dir="auto">I get this issue: <code class="notranslate">WARNING:tensorflow:Using temporary folder as model directory: C:\Users\elavi\AppData\Local\Temp\tmprirdvmnn INFO:tensorflow:Using default config. INFO:tensorflow:Using config: {'_tf_config': gpu_options { per_process_gpu_memory_fraction: 1 } , '_task_type': None, '_save_checkpoints_steps': None, '_master': '', '_is_chief': True, '_cluster_spec': &lt;tensorflow.python.training.server_lib.ClusterSpec object at 0x0000021D2049C390&gt;, '_task_id': 0, '_save_checkpoints_secs': 600, '_save_summary_steps': 100, '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_evaluation_master': '', '_tf_random_seed': None, '_environment': 'local', '_num_ps_replicas': 0}</code></p>
<p dir="auto">Angle 2: It may be more helpful to see how I run it as a script as a whole. The output is:<br>
<code class="notranslate">WARNING:tensorflow:Using temporary folder as model directory: C:\Users\elavi\AppData\Local\Temp\tmp41huenz5 WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change. WARNING:tensorflow:From C:\Users\elavi\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\head.py:521: scalar_summary (from tensorflow.python.ops.logging_ops) is deprecated and will be removed after 2016-11-30. Instructions for updating: Please switch to tf.summary.scalar. Note that tf.summary.scalar uses the node name instead of the tag. This means that TensorFlow will automatically de-duplicate summary names based on the scope they are created in. Also, passing a tensor or list of tags to a scalar summary op is no longer supported. 2017-02-24 00:02:36.386704: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations. 2017-02-24 00:02:36.388071: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations. 2017-02-24 00:02:36.389235: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. 2017-02-24 00:02:36.389290: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2017-02-24 00:02:36.390010: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2017-02-24 00:02:36.390894: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2017-02-24 00:02:36.391659: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2017-02-24 00:02:36.392248: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change. WARNING:tensorflow:From C:\Users\elavi\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\head.py:521: scalar_summary (from tensorflow.python.ops.logging_ops) is deprecated and will be removed after 2016-11-30. Instructions for updating: Please switch to tf.summary.scalar. Note that tf.summary.scalar uses the node name instead of the tag. This means that TensorFlow will automatically de-duplicate summary names based on the scope they are created in. Also, passing a tensor or list of tags to a scalar summary op is no longer supported. WARNING:tensorflow:Skipping summary for global_step, must be a float or np.float32. </code></p>
<p dir="auto">I am interested in what is going on but I really need things simplified. A list of steps to fix this would be great. Also, if there are any better ways I could pose my problems in the future, please let me know.</p>
<h3 dir="auto">What related GitHub issues or StackOverflow threads have you found by searching the web for your problem?</h3>
<p dir="auto">Many. The issue is that I am very new. My ability to understand solutions is very small. I am not well versed with the required terminology. So I have seen this problem posed and closed but I just can't follow along.</p>
<h3 dir="auto">Environment info</h3>
<p dir="auto">Operating System: Windows 10</p>
<p dir="auto">Installed version of CUDA and cuDNN: I have the latest version but I probably shouldn't because I do not have a dedicated graphics card. (I am doing initial development on Microsoft Surface Pro 4)</p>
<p dir="auto">TF Version<br>
1.0.0-rc2</p>