<p dir="auto">If I've interpreted it correctly seems that there is some strange behavior with Keras multi inputs and the estimator.</p>
<ul dir="auto">
<li>Why input layers are renamed with <code class="notranslate">_1</code> suffix?</li>
<li>Why TB display a <code class="notranslate">_2</code> suffixed parallel sub-graph?</li>
</ul>
<p dir="auto">I've attached a snippet runnable on <a href="http://colab.research.google.com/" rel="nofollow">colab</a> and the TB rendered image.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from tensorflow import keras as ks
import numpy as np
from IPython.display import clear_output, Image, display, HTML

def strip_consts(graph_def, max_const_size=32):
    &quot;&quot;&quot;Strip large constant values from graph_def.&quot;&quot;&quot;
    strip_def = tf.GraphDef()
    for n0 in graph_def.node:
        n = strip_def.node.add() 
        n.MergeFrom(n0)
        if n.op == 'Const':
            tensor = n.attr['value'].tensor
            size = len(tensor.tensor_content)
            if size &gt; max_const_size:
                tensor.tensor_content = &quot;&lt;stripped %d bytes&gt;&quot;%size
    return strip_def

def show_graph(graph_def, max_const_size=32):
    &quot;&quot;&quot;Visualize TensorFlow graph.&quot;&quot;&quot;
    if hasattr(graph_def, 'as_graph_def'):
        graph_def = graph_def.as_graph_def()
    strip_def = strip_consts(graph_def, max_const_size=max_const_size)
    code = &quot;&quot;&quot;
        &lt;script src=&quot;//cdnjs.cloudflare.com/ajax/libs/polymer/0.3.3/platform.js&quot;&gt;&lt;/script&gt;
        &lt;script&gt;
          function load() {{
            document.getElementById(&quot;{id}&quot;).pbtxt = {data};
          }}
        &lt;/script&gt;
        &lt;link rel=&quot;import&quot; href=&quot;https://tensorboard.appspot.com/tf-graph-basic.build.html&quot; onload=load()&gt;
        &lt;div style=&quot;height:600px&quot;&gt;
          &lt;tf-graph-basic id=&quot;{id}&quot;&gt;&lt;/tf-graph-basic&gt;
        &lt;/div&gt;
    &quot;&quot;&quot;.format(data=repr(str(strip_def)), id='graph'+str(np.random.rand()))

    iframe = &quot;&quot;&quot;
        &lt;iframe seamless style=&quot;width:1200px;height:620px;border:0&quot; srcdoc=&quot;{}&quot;&gt;&lt;/iframe&gt;
    &quot;&quot;&quot;.format(code.replace('&quot;', '&amp;quot;'))
    display(HTML(iframe))

class ExampleHook(tf.train.SessionRunHook):
    def __init__(self):
        print('Starting the session.')
        return

    def begin(self):
        g = tf.get_default_graph()
        show_graph(g)
        print('Starting the session.')
        
        #for op in tf.get_default_graph().get_operations():
          #print(str(op.name) )
        
my_input_fn = tf.estimator.inputs.numpy_input_fn(
    x={&quot;input_rgb&quot;: np.array(np.random.rand(5,5,3).astype(np.float32)), &quot;input_gray&quot;: np.array(np.random.rand(5,5,1).astype(np.float32)), 
       &quot;input_mix&quot;: np.array(np.random.rand(5,5,1).astype(np.float32))},
    y= np.array(np.random.rand(5,5,1)),
      batch_size=1,
      num_epochs=1,
      shuffle=False)

input_rgb = ks.layers.Input(shape=(1,5, 5, 3), name=&quot;input_rgb&quot;)
input_gray = ks.layers.Input(shape=(1,5, 5, 1), name=&quot;input_gray&quot;)
input_mix = ks.layers.Input(shape=(1,5, 5, 1), name=&quot;input_mix&quot;)
rgb_gray = ks.layers.concatenate([input_rgb, input_gray, input_mix], name=&quot;rbg_gray&quot;)
x = ks.layers.Dense(1, activation='relu',name=&quot;Dense_1&quot;)(rgb_gray)
x = ks.layers.Dense(1, activation='softmax',name=&quot;softmax&quot;)(x)
model = ks.models.Model(
        inputs=[input_rgb, input_gray, input_mix],
        outputs=[x])
model.compile(loss={ 'softmax': 'binary_crossentropy'},optimizer=tf.keras.optimizers.Adam())


est = ks.estimator.model_to_estimator(
            keras_model=model)

model.summary()
print(model.input_names)
pred = list(est.predict(
    input_fn=my_input_fn,
    predict_keys=None,
    hooks=[ExampleHook()],
))"><pre lang="import" class="notranslate"><code class="notranslate">from tensorflow import keras as ks
import numpy as np
from IPython.display import clear_output, Image, display, HTML

def strip_consts(graph_def, max_const_size=32):
    """Strip large constant values from graph_def."""
    strip_def = tf.GraphDef()
    for n0 in graph_def.node:
        n = strip_def.node.add() 
        n.MergeFrom(n0)
        if n.op == 'Const':
            tensor = n.attr['value'].tensor
            size = len(tensor.tensor_content)
            if size &gt; max_const_size:
                tensor.tensor_content = "&lt;stripped %d bytes&gt;"%size
    return strip_def

def show_graph(graph_def, max_const_size=32):
    """Visualize TensorFlow graph."""
    if hasattr(graph_def, 'as_graph_def'):
        graph_def = graph_def.as_graph_def()
    strip_def = strip_consts(graph_def, max_const_size=max_const_size)
    code = """
        &lt;script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.3.3/platform.js"&gt;&lt;/script&gt;
        &lt;script&gt;
          function load() {{
            document.getElementById("{id}").pbtxt = {data};
          }}
        &lt;/script&gt;
        &lt;link rel="import" href="https://tensorboard.appspot.com/tf-graph-basic.build.html" onload=load()&gt;
        &lt;div style="height:600px"&gt;
          &lt;tf-graph-basic id="{id}"&gt;&lt;/tf-graph-basic&gt;
        &lt;/div&gt;
    """.format(data=repr(str(strip_def)), id='graph'+str(np.random.rand()))

    iframe = """
        &lt;iframe seamless style="width:1200px;height:620px;border:0" srcdoc="{}"&gt;&lt;/iframe&gt;
    """.format(code.replace('"', '&amp;quot;'))
    display(HTML(iframe))

class ExampleHook(tf.train.SessionRunHook):
    def __init__(self):
        print('Starting the session.')
        return

    def begin(self):
        g = tf.get_default_graph()
        show_graph(g)
        print('Starting the session.')
        
        #for op in tf.get_default_graph().get_operations():
          #print(str(op.name) )
        
my_input_fn = tf.estimator.inputs.numpy_input_fn(
    x={"input_rgb": np.array(np.random.rand(5,5,3).astype(np.float32)), "input_gray": np.array(np.random.rand(5,5,1).astype(np.float32)), 
       "input_mix": np.array(np.random.rand(5,5,1).astype(np.float32))},
    y= np.array(np.random.rand(5,5,1)),
      batch_size=1,
      num_epochs=1,
      shuffle=False)

input_rgb = ks.layers.Input(shape=(1,5, 5, 3), name="input_rgb")
input_gray = ks.layers.Input(shape=(1,5, 5, 1), name="input_gray")
input_mix = ks.layers.Input(shape=(1,5, 5, 1), name="input_mix")
rgb_gray = ks.layers.concatenate([input_rgb, input_gray, input_mix], name="rbg_gray")
x = ks.layers.Dense(1, activation='relu',name="Dense_1")(rgb_gray)
x = ks.layers.Dense(1, activation='softmax',name="softmax")(x)
model = ks.models.Model(
        inputs=[input_rgb, input_gray, input_mix],
        outputs=[x])
model.compile(loss={ 'softmax': 'binary_crossentropy'},optimizer=tf.keras.optimizers.Adam())


est = ks.estimator.model_to_estimator(
            keras_model=model)

model.summary()
print(model.input_names)
pred = list(est.predict(
    input_fn=my_input_fn,
    predict_keys=None,
    hooks=[ExampleHook()],
))
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1710528/35459923-5eca90b8-02e2-11e8-8248-764671141850.png"><img src="https://user-images.githubusercontent.com/1710528/35459923-5eca90b8-02e2-11e8-8248-764671141850.png" alt="tb" style="max-width: 100%;"></a></p>
<p dir="auto">Hello, guys.<br>
I got an error just after install Python 3.5.3 and Tensorflow in a Windows 10 system and it fails in the very first test, the one suggested in Tensorflow install instructions.<br>
The messages I got are here:</p>
<p dir="auto">Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)] on win32<br>
Type "help", "copyright", "credits" or "license" for more information.</p>
<blockquote>
<blockquote>
<blockquote>
<p dir="auto">import tensorflow as tf<br>
hello=tf.constant('Hello')<br>
sess=tf.Session()<br>
print(sess.run(hello))<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "CountExtremelyRandomStats" device_type: "CPU"') for unknown op: CountExtremelyRandomStats<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "FinishedNodes" device_type: "CPU"') for unknown op: FinishedNodes<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "GrowTree" device_type: "CPU"') for unknown op: GrowTree<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ReinterpretStringToFloat" device_type: "CPU"') for unknown op: ReinterpretStringToFloat<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "SampleInputs" device_type: "CPU"') for unknown op: SampleInputs<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ScatterAddNdim" device_type: "CPU"') for unknown op: ScatterAddNdim<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNInsert" device_type: "CPU"') for unknown op: TopNInsert<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNRemove" device_type: "CPU"') for unknown op: TopNRemove<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TreePredictions" device_type: "CPU"') for unknown op: TreePredictions<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "UpdateFertileSlots" device_type: "CPU"') for unknown op: UpdateFertileSlots<br>
b'Hello'</p>
</blockquote>
</blockquote>
</blockquote>
<p dir="auto">Do you know how to fix this issue.</p>
<p dir="auto">Thanks in advance,</p>
<p dir="auto">Daniel Vermes</p>