<p dir="auto">Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question on <a href="http://stackoverflow.com/questions/tagged/keras" rel="nofollow">StackOverflow</a> or <a href="https://keras-slack-autojoin.herokuapp.com/" rel="nofollow">join the Keras Slack channel</a> and ask there instead of filing a GitHub issue.</p>
<p dir="auto">Thank you!</p>
<ul class="contains-task-list">
<li class="task-list-item">
<p dir="auto"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Check that you are up-to-date with the master branch of Keras. You can update with:<br>
pip install git+git://github.com/keras-team/keras.git --upgrade --no-deps</p>
</li>
<li class="task-list-item">
<p dir="auto"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found <a href="https://www.tensorflow.org/get_started/os_setup" rel="nofollow">here</a>.</p>
</li>
<li class="task-list-item">
<p dir="auto"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:<br>
pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps</p>
</li>
<li class="task-list-item">
<p dir="auto"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).</p>
</li>
</ul>
<hr>
<p dir="auto">If I create a layer which is shared by two models that are incorporated into another model, then when compiling against the CNTK backend, I get an exception when falling <code class="notranslate">fit</code>.  The following simple example works fine against the Theano and Tensorflow backends, but fails against CNTK:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="x1 = keras.layers.Input((1,))
x2 = keras.layers.Input((1,))
x3 = keras.layers.Input((1,))

l = keras.layers.Dense(2)

m1 = keras.Model([x1], [l(x1)])
m2 = keras.Model([x2], [l(x2)])

m = keras.Model([x3], [keras.layers.concatenate([m1(x3), m2(x3)])])
m.compile('sgd', 'mse')
m.summary()
m.fit([np.ones((1,1))], np.ones((1,4)))"><pre class="notranslate"><code class="notranslate">x1 = keras.layers.Input((1,))
x2 = keras.layers.Input((1,))
x3 = keras.layers.Input((1,))

l = keras.layers.Dense(2)

m1 = keras.Model([x1], [l(x1)])
m2 = keras.Model([x2], [l(x2)])

m = keras.Model([x3], [keras.layers.concatenate([m1(x3), m2(x3)])])
m.compile('sgd', 'mse')
m.summary()
m.fit([np.ones((1,1))], np.ones((1,4)))
</code></pre></div>
<p dir="auto">Here's the error I get:</p>
<blockquote>
<p dir="auto">ValueError: Learner's parameters list must not contain duplicates.</p>
<p dir="auto">[CALL STACK]<br>
&gt; CNTK::TrainingParameterSchedule::  GetMinibatchSize<br>
- CNTK::  ZerosLike (x2)<br>
- CNTK::  UniversalLearner<br>
- PyInit__cntk_py (x2)<br>
- PyCFunction_FastCallDict<br>
- PyObject_GenericGetAttr<br>
- PyEval_EvalFrameDefault<br>
- PyErr_Occurred<br>
- PyFunction_FastCallDict<br>
- PyObject_CallFunctionObjArgs<br>
- PyUnicode_AsUTF8AndSize<br>
- PyFrame_New<br>
- PyEval_EvalFrameDefault<br>
- PyErr_Occurred</p>
</blockquote>
<p dir="auto">Note that the summary call correctly indicates that there are only 4 trainable parameters (because the layer is shared between the two models):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to
==================================================================================================
input_3 (InputLayer)            (None, 1)            0
__________________________________________________________________________________________________
model_1 (Model)                 (None, 2)            4           input_3[0][0]
__________________________________________________________________________________________________
model_2 (Model)                 (None, 2)            4           input_3[0][0]
__________________________________________________________________________________________________
concatenate_1 (Concatenate)     (None, 4)            0           model_1[1][0]
                                                                 model_2[1][0]
==================================================================================================
Total params: 4
Trainable params: 4
Non-trainable params: 0"><pre class="notranslate"><code class="notranslate">__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to
==================================================================================================
input_3 (InputLayer)            (None, 1)            0
__________________________________________________________________________________________________
model_1 (Model)                 (None, 2)            4           input_3[0][0]
__________________________________________________________________________________________________
model_2 (Model)                 (None, 2)            4           input_3[0][0]
__________________________________________________________________________________________________
concatenate_1 (Concatenate)     (None, 4)            0           model_1[1][0]
                                                                 model_2[1][0]
==================================================================================================
Total params: 4
Trainable params: 4
Non-trainable params: 0
</code></pre></div>
<p dir="auto">According to <a href="url">https://keras.io/preprocessing/image/#apply_transform</a> , apply_transform is still under  keras.preprocessing.image which is not the case.</p>