<p dir="auto">Hello everyone,</p>
<p dir="auto">First of all I'ld like to thank for the great job you are doing here.</p>
<p dir="auto">I was working on autoencoder examples at <a href="http://blog.keras.io/building-autoencoders-in-keras.html" rel="nofollow">http://blog.keras.io/building-autoencoders-in-keras.html</a>. When I came to CNN autoencoder, I'm stucked. Did anybody run CNN autoencoder(s) w/ Theano?</p>
<p dir="auto">The example uses TensorFlow whereas I want to use Theano. This is what I have got so far:</p>
<p dir="auto">= Versions</p>
<ul dir="auto">
<li>Python 2.7 (from WinPython) running on Windows 7</li>
<li>Theano - latest code from github</li>
<li>Keras - latest code from github</li>
</ul>
<p dir="auto">= CNN Autoencoder /w functional API<br>
Sample Code: <a href="https://gist.github.com/zakkum42/71c1ac9577a6eb2b6260dcdf7efd27d7">https://gist.github.com/zakkum42/71c1ac9577a6eb2b6260dcdf7efd27d7</a><br>
Output/Error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Using Theano backend.
(60000L, 1L, 28L, 28L)
(10000L, 1L, 28L, 28L)
ERROR (theano.gof.opt): Optimization failure due to: local_abstractconv_check
ERROR (theano.gof.opt): node: AbstractConv2d{border_mode='half', subsample=(1, 1), filter_flip=True, imshp=(None, None, None, None), kshp=(16, 1, 3, 3)}(input_1, convolution2d_1_W)
ERROR (theano.gof.opt): TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
  File &quot;D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\theano-0.8.2-py2.7.egg\theano\gof\opt.py&quot;, line 1772, in process_node
    replacements = lopt.transform(node)
  File &quot;D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\theano-0.8.2-py2.7.egg\theano\tensor\nnet\opt.py&quot;, line 402, in local_abstractconv_check
    node.op.__class__.__name__)
AssertionError: AbstractConv2d Theano optimization failed: there is no implementation available supporting the requested options. Did you exclude both &quot;conv_dnn&quot; and &quot;conv_gemm&quot; from the optimizer? If on GPU, is cuDNN available and does the GPU support it? If on CPU, do you have a BLAS library installed Theano can link against?"><pre class="notranslate"><code class="notranslate">Using Theano backend.
(60000L, 1L, 28L, 28L)
(10000L, 1L, 28L, 28L)
ERROR (theano.gof.opt): Optimization failure due to: local_abstractconv_check
ERROR (theano.gof.opt): node: AbstractConv2d{border_mode='half', subsample=(1, 1), filter_flip=True, imshp=(None, None, None, None), kshp=(16, 1, 3, 3)}(input_1, convolution2d_1_W)
ERROR (theano.gof.opt): TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
  File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\theano-0.8.2-py2.7.egg\theano\gof\opt.py", line 1772, in process_node
    replacements = lopt.transform(node)
  File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\theano-0.8.2-py2.7.egg\theano\tensor\nnet\opt.py", line 402, in local_abstractconv_check
    node.op.__class__.__name__)
AssertionError: AbstractConv2d Theano optimization failed: there is no implementation available supporting the requested options. Did you exclude both "conv_dnn" and "conv_gemm" from the optimizer? If on GPU, is cuDNN available and does the GPU support it? If on CPU, do you have a BLAS library installed Theano can link against?
</code></pre></div>
<p dir="auto">Question: Is the case that the original example is for TensorFlow only?</p>
<p dir="auto">= CNN Autoencoder /w Sequential Model<br>
Sample Code: <a href="https://gist.github.com/zakkum42/b251165232298425617944ab01e4cde6/7b350b4a56fb62768cf306484f0adf7f3455fb88">https://gist.github.com/zakkum42/b251165232298425617944ab01e4cde6/7b350b4a56fb62768cf306484f0adf7f3455fb88</a><br>
Output/Error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Using Theano backend.
Traceback (most recent call last):
  File &quot;D:\PYTHON2-DEV\Li_ws\CSE555\src\som\keras_cnn_ae_sequential.py&quot;, line 59, in &lt;module&gt;
('x_train shape:', (60000L, 1L, 28L, 28L))
(60000L, 'trai    validation_data=(x_test, x_test))
  File &quot;D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\models.py&quot;, line 408, in fit
    sample_weight=sample_weight)
  File &quot;D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\engine\training.py&quot;, line 994, in fit
    batch_size=batch_size)
  File &quot;D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\engine\training.py&quot;, line 925, in _standardize_user_data
    exception_prefix='model target')
  File &quot;D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\engine\training.py&quot;, line 104, in standardize_input_data
    str(array.shape))
Exception: Error when checking model target: expected convolution2d_7 to have shape (None, 1, 24, 24) but got array with shape (60000L, 1L, 28L, 28L)
n samples')
(10000L, 'test samples')"><pre class="notranslate"><code class="notranslate">Using Theano backend.
Traceback (most recent call last):
  File "D:\PYTHON2-DEV\Li_ws\CSE555\src\som\keras_cnn_ae_sequential.py", line 59, in &lt;module&gt;
('x_train shape:', (60000L, 1L, 28L, 28L))
(60000L, 'trai    validation_data=(x_test, x_test))
  File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\models.py", line 408, in fit
    sample_weight=sample_weight)
  File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\engine\training.py", line 994, in fit
    batch_size=batch_size)
  File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\engine\training.py", line 925, in _standardize_user_data
    exception_prefix='model target')
  File "D:\PYTHON2-DEV\WinPython\python-2.7.10.amd64\lib\site-packages\keras-1.0.3-py2.7.egg\keras\engine\training.py", line 104, in standardize_input_data
    str(array.shape))
Exception: Error when checking model target: expected convolution2d_7 to have shape (None, 1, 24, 24) but got array with shape (60000L, 1L, 28L, 28L)
n samples')
(10000L, 'test samples')
</code></pre></div>
<p dir="auto">Based on the generated graph, convolution2d_7 accepts shape (None, 1, 24, 24), but the input is not converted to this shape.</p>
<p dir="auto">Any suggestions on any of the two implementations?</p>
<p dir="auto">Thank you in advance</p>
<p dir="auto">K.</p>
<p dir="auto">Please make sure that the boxes below are checked before you submit your issue.<br>
If your issue is an <strong>implementation question</strong>, 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">on the Keras Slack channel</a> instead of opening 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>
<code class="notranslate">pip install git+git://github.com/keras-team/keras.git --upgrade --no-deps</code></p>
</li>
<li class="task-list-item">
<p dir="auto"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Check that your version of TensorFlow is up-to-date. 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=""> 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>
<h3 dir="auto">Introduction</h3>
<p dir="auto">I'm currently following the Plural Sight course on setting up Keras and using it for Object Detection. However with the second script I'm running into an AssertionError:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/2350015/55736756-438ac080-5a24-11e9-9b64-4992cf691e62.png"><img src="https://user-images.githubusercontent.com/2350015/55736756-438ac080-5a24-11e9-9b64-4992cf691e62.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">Code used for the course:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#   deep_circles.py
#   Defines a network that can find separate circles of data
#

#   Imports
from sklearn.datasets import make_circles
import numpy as np
import matplotlib.pyplot as plt
import os
os.environ[&quot;TF_CPP_MIN_LOG_LEVEL&quot;]=&quot;2&quot;

#   Helper functions

#   plot the data on a figure
def plot_data(pl, X, y):
    # plot class where y==0
    pl.plot(X[y==0, 0], X[y==0,1], 'ob', alpha=0.5)
    # plot class where y==1
    pl.plot(X[y==1, 0], X[y==1,1], 'xr', alpha=0.5)
    pl.legend(['0', '1'])
    return pl

#   Common function that draws the decision boundaries
def plot_decision_boundary(model, X, y):

    amin, bmin = X.min(axis=0) - 0.1
    amax, bmax = X.max(axis=0) + 0.1
    hticks = np.linspace(amin, amax, 101)
    vticks = np.linspace(bmin, bmax, 101)
    
    aa, bb = np.meshgrid(hticks, vticks)
    ab = np.c_[aa.ravel(), bb.ravel()]
    
    # make prediction with the model and reshape the output so contourf can plot it
    c = model.predict(ab)
    Z = c.reshape(aa.shape)

    plt.figure(figsize=(12, 8))
    # plot the contour
    plt.contourf(aa, bb, Z, cmap='bwr', alpha=0.2)
    # plot the moons of data
    plot_data(plt, X, y)

    return plt


# Generate some data blobs.  Data will be either 0 or 1 when 2 is number of centers.
# X is a [number of samples, 2] sized array. X[sample] contains its x,y position of the sample in the space
# ex: X[1] = [1.342, -2.3], X[2] = [-4.342, 2.12]
# y is a [number of samples] sized array. y[sample] contains the class index (ie. 0 or 1 when there are 2 centers)
# ex: y[1] = 0 , y[1] = 1
X, y = make_circles(n_samples=1000, factor=.6, noise=0.1, random_state=42)
#pl = plot_data(plt, X, y)
#pl.show()

# Split the data into Training and Test sets
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)

# Create the keras model
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam

#   Simple Sequential model
model = Sequential()
model.add(Dense(4, input_shape=(2,), activation=&quot;tanh&quot;, name=&quot;Hidden-1&quot;))
model.add(Dense(4, activation=&quot;tanh&quot;, name=&quot;Hidden-2&quot;))
#   Add a Dense Fully Connected Layer with 1 neuron.  Using input_shape = (2,) says the input will 
#       be arrays of the form (*,2).  The first dimension will be an unspecified 
#       number of batches (rows) of data.  The second dimension is 2 which are the X, Y positions of each data element.
#       The sigmoid activation function is used to return 0 or 1, signifying the data 
#       cluster the position is predicted to belong to.
model.add(Dense(1, activation=&quot;sigmoid&quot;, name=&quot;output_layer&quot;))
model.summary()
#   Compile the model.  Minimize crossentopy for a binary.  Maximize for accuracy
model.compile(Adam(lr=0.05), 'binary_crossentropy', metrics=['accuracy'])
from keras.utils import plot_model
plot_model(model, to_file=&quot;model.png&quot;, show_shapes=True, show_layer_names=True)

# The line above here fails




#   Define early stopping callback
from keras.callbacks import EarlyStopping
my_callbacks = [EarlyStopping(monitor='val_acc', patience=5, mode='max')]
#   Fit the model with the data from make_blobs.  Make 100 cycles through the data.
#       Set verbose to 0 to supress progress messages 
model.fit(X_train, y_train, epochs=100, verbose=1, callbacks=my_callbacks, validation_data=(X_test, y_test))
#   Get loss and accuracy on test data
eval_result = model.evaluate(X_test, y_test)
#   Print test accuracy
print(&quot;\n\nTest loss:&quot;, eval_result[0], &quot;Test accuracy:&quot;, eval_result[1])
#   Plot the decision boundary
plot_decision_boundary(model, X, y).show()"><pre class="notranslate"><span class="pl-c">#   deep_circles.py</span>
<span class="pl-c">#   Defines a network that can find separate circles of data</span>
<span class="pl-c">#</span>

<span class="pl-c">#   Imports</span>
<span class="pl-k">from</span> <span class="pl-s1">sklearn</span>.<span class="pl-s1">datasets</span> <span class="pl-k">import</span> <span class="pl-s1">make_circles</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-k">import</span> <span class="pl-s1">os</span>
<span class="pl-s1">os</span>.<span class="pl-s1">environ</span>[<span class="pl-s">"TF_CPP_MIN_LOG_LEVEL"</span>]<span class="pl-c1">=</span><span class="pl-s">"2"</span>

<span class="pl-c">#   Helper functions</span>

<span class="pl-c">#   plot the data on a figure</span>
<span class="pl-k">def</span> <span class="pl-en">plot_data</span>(<span class="pl-s1">pl</span>, <span class="pl-v">X</span>, <span class="pl-s1">y</span>):
    <span class="pl-c"># plot class where y==0</span>
    <span class="pl-s1">pl</span>.<span class="pl-en">plot</span>(<span class="pl-v">X</span>[<span class="pl-s1">y</span><span class="pl-c1">==</span><span class="pl-c1">0</span>, <span class="pl-c1">0</span>], <span class="pl-v">X</span>[<span class="pl-s1">y</span><span class="pl-c1">==</span><span class="pl-c1">0</span>,<span class="pl-c1">1</span>], <span class="pl-s">'ob'</span>, <span class="pl-s1">alpha</span><span class="pl-c1">=</span><span class="pl-c1">0.5</span>)
    <span class="pl-c"># plot class where y==1</span>
    <span class="pl-s1">pl</span>.<span class="pl-en">plot</span>(<span class="pl-v">X</span>[<span class="pl-s1">y</span><span class="pl-c1">==</span><span class="pl-c1">1</span>, <span class="pl-c1">0</span>], <span class="pl-v">X</span>[<span class="pl-s1">y</span><span class="pl-c1">==</span><span class="pl-c1">1</span>,<span class="pl-c1">1</span>], <span class="pl-s">'xr'</span>, <span class="pl-s1">alpha</span><span class="pl-c1">=</span><span class="pl-c1">0.5</span>)
    <span class="pl-s1">pl</span>.<span class="pl-en">legend</span>([<span class="pl-s">'0'</span>, <span class="pl-s">'1'</span>])
    <span class="pl-k">return</span> <span class="pl-s1">pl</span>

<span class="pl-c">#   Common function that draws the decision boundaries</span>
<span class="pl-k">def</span> <span class="pl-en">plot_decision_boundary</span>(<span class="pl-s1">model</span>, <span class="pl-v">X</span>, <span class="pl-s1">y</span>):

    <span class="pl-s1">amin</span>, <span class="pl-s1">bmin</span> <span class="pl-c1">=</span> <span class="pl-v">X</span>.<span class="pl-en">min</span>(<span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">0</span>) <span class="pl-c1">-</span> <span class="pl-c1">0.1</span>
    <span class="pl-s1">amax</span>, <span class="pl-s1">bmax</span> <span class="pl-c1">=</span> <span class="pl-v">X</span>.<span class="pl-en">max</span>(<span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">0</span>) <span class="pl-c1">+</span> <span class="pl-c1">0.1</span>
    <span class="pl-s1">hticks</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-s1">amin</span>, <span class="pl-s1">amax</span>, <span class="pl-c1">101</span>)
    <span class="pl-s1">vticks</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-s1">bmin</span>, <span class="pl-s1">bmax</span>, <span class="pl-c1">101</span>)
    
    <span class="pl-s1">aa</span>, <span class="pl-s1">bb</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">meshgrid</span>(<span class="pl-s1">hticks</span>, <span class="pl-s1">vticks</span>)
    <span class="pl-s1">ab</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">c_</span>[<span class="pl-s1">aa</span>.<span class="pl-en">ravel</span>(), <span class="pl-s1">bb</span>.<span class="pl-en">ravel</span>()]
    
    <span class="pl-c"># make prediction with the model and reshape the output so contourf can plot it</span>
    <span class="pl-s1">c</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-en">predict</span>(<span class="pl-s1">ab</span>)
    <span class="pl-v">Z</span> <span class="pl-c1">=</span> <span class="pl-s1">c</span>.<span class="pl-en">reshape</span>(<span class="pl-s1">aa</span>.<span class="pl-s1">shape</span>)

    <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>(<span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">12</span>, <span class="pl-c1">8</span>))
    <span class="pl-c"># plot the contour</span>
    <span class="pl-s1">plt</span>.<span class="pl-en">contourf</span>(<span class="pl-s1">aa</span>, <span class="pl-s1">bb</span>, <span class="pl-v">Z</span>, <span class="pl-s1">cmap</span><span class="pl-c1">=</span><span class="pl-s">'bwr'</span>, <span class="pl-s1">alpha</span><span class="pl-c1">=</span><span class="pl-c1">0.2</span>)
    <span class="pl-c"># plot the moons of data</span>
    <span class="pl-en">plot_data</span>(<span class="pl-s1">plt</span>, <span class="pl-v">X</span>, <span class="pl-s1">y</span>)

    <span class="pl-k">return</span> <span class="pl-s1">plt</span>


<span class="pl-c"># Generate some data blobs.  Data will be either 0 or 1 when 2 is number of centers.</span>
<span class="pl-c"># X is a [number of samples, 2] sized array. X[sample] contains its x,y position of the sample in the space</span>
<span class="pl-c"># ex: X[1] = [1.342, -2.3], X[2] = [-4.342, 2.12]</span>
<span class="pl-c"># y is a [number of samples] sized array. y[sample] contains the class index (ie. 0 or 1 when there are 2 centers)</span>
<span class="pl-c"># ex: y[1] = 0 , y[1] = 1</span>
<span class="pl-v">X</span>, <span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-en">make_circles</span>(<span class="pl-s1">n_samples</span><span class="pl-c1">=</span><span class="pl-c1">1000</span>, <span class="pl-s1">factor</span><span class="pl-c1">=</span><span class="pl-c1">.6</span>, <span class="pl-s1">noise</span><span class="pl-c1">=</span><span class="pl-c1">0.1</span>, <span class="pl-s1">random_state</span><span class="pl-c1">=</span><span class="pl-c1">42</span>)
<span class="pl-c">#pl = plot_data(plt, X, y)</span>
<span class="pl-c">#pl.show()</span>

<span class="pl-c"># Split the data into Training and Test sets</span>
<span class="pl-k">from</span> <span class="pl-s1">sklearn</span>.<span class="pl-s1">model_selection</span> <span class="pl-k">import</span> <span class="pl-s1">train_test_split</span>
<span class="pl-v">X_train</span>, <span class="pl-v">X_test</span>, <span class="pl-s1">y_train</span>, <span class="pl-s1">y_test</span> <span class="pl-c1">=</span> <span class="pl-en">train_test_split</span>(<span class="pl-v">X</span>, <span class="pl-s1">y</span>, <span class="pl-s1">test_size</span><span class="pl-c1">=</span><span class="pl-c1">0.3</span>, <span class="pl-s1">random_state</span><span class="pl-c1">=</span><span class="pl-c1">42</span>)

<span class="pl-c"># Create the keras model</span>
<span class="pl-k">from</span> <span class="pl-s1">keras</span>.<span class="pl-s1">models</span> <span class="pl-k">import</span> <span class="pl-v">Sequential</span>
<span class="pl-k">from</span> <span class="pl-s1">keras</span>.<span class="pl-s1">layers</span> <span class="pl-k">import</span> <span class="pl-v">Dense</span>
<span class="pl-k">from</span> <span class="pl-s1">keras</span>.<span class="pl-s1">optimizers</span> <span class="pl-k">import</span> <span class="pl-v">Adam</span>

<span class="pl-c">#   Simple Sequential model</span>
<span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">Sequential</span>()
<span class="pl-s1">model</span>.<span class="pl-en">add</span>(<span class="pl-v">Dense</span>(<span class="pl-c1">4</span>, <span class="pl-s1">input_shape</span><span class="pl-c1">=</span>(<span class="pl-c1">2</span>,), <span class="pl-s1">activation</span><span class="pl-c1">=</span><span class="pl-s">"tanh"</span>, <span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">"Hidden-1"</span>))
<span class="pl-s1">model</span>.<span class="pl-en">add</span>(<span class="pl-v">Dense</span>(<span class="pl-c1">4</span>, <span class="pl-s1">activation</span><span class="pl-c1">=</span><span class="pl-s">"tanh"</span>, <span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">"Hidden-2"</span>))
<span class="pl-c">#   Add a Dense Fully Connected Layer with 1 neuron.  Using input_shape = (2,) says the input will </span>
<span class="pl-c">#       be arrays of the form (*,2).  The first dimension will be an unspecified </span>
<span class="pl-c">#       number of batches (rows) of data.  The second dimension is 2 which are the X, Y positions of each data element.</span>
<span class="pl-c">#       The sigmoid activation function is used to return 0 or 1, signifying the data </span>
<span class="pl-c">#       cluster the position is predicted to belong to.</span>
<span class="pl-s1">model</span>.<span class="pl-en">add</span>(<span class="pl-v">Dense</span>(<span class="pl-c1">1</span>, <span class="pl-s1">activation</span><span class="pl-c1">=</span><span class="pl-s">"sigmoid"</span>, <span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">"output_layer"</span>))
<span class="pl-s1">model</span>.<span class="pl-en">summary</span>()
<span class="pl-c">#   Compile the model.  Minimize crossentopy for a binary.  Maximize for accuracy</span>
<span class="pl-s1">model</span>.<span class="pl-en">compile</span>(<span class="pl-v">Adam</span>(<span class="pl-s1">lr</span><span class="pl-c1">=</span><span class="pl-c1">0.05</span>), <span class="pl-s">'binary_crossentropy'</span>, <span class="pl-s1">metrics</span><span class="pl-c1">=</span>[<span class="pl-s">'accuracy'</span>])
<span class="pl-k">from</span> <span class="pl-s1">keras</span>.<span class="pl-s1">utils</span> <span class="pl-k">import</span> <span class="pl-s1">plot_model</span>
<span class="pl-en">plot_model</span>(<span class="pl-s1">model</span>, <span class="pl-s1">to_file</span><span class="pl-c1">=</span><span class="pl-s">"model.png"</span>, <span class="pl-s1">show_shapes</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, <span class="pl-s1">show_layer_names</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)

<span class="pl-c"># The line above here fails</span>




<span class="pl-c">#   Define early stopping callback</span>
<span class="pl-k">from</span> <span class="pl-s1">keras</span>.<span class="pl-s1">callbacks</span> <span class="pl-k">import</span> <span class="pl-v">EarlyStopping</span>
<span class="pl-s1">my_callbacks</span> <span class="pl-c1">=</span> [<span class="pl-v">EarlyStopping</span>(<span class="pl-s1">monitor</span><span class="pl-c1">=</span><span class="pl-s">'val_acc'</span>, <span class="pl-s1">patience</span><span class="pl-c1">=</span><span class="pl-c1">5</span>, <span class="pl-s1">mode</span><span class="pl-c1">=</span><span class="pl-s">'max'</span>)]
<span class="pl-c">#   Fit the model with the data from make_blobs.  Make 100 cycles through the data.</span>
<span class="pl-c">#       Set verbose to 0 to supress progress messages </span>
<span class="pl-s1">model</span>.<span class="pl-en">fit</span>(<span class="pl-v">X_train</span>, <span class="pl-s1">y_train</span>, <span class="pl-s1">epochs</span><span class="pl-c1">=</span><span class="pl-c1">100</span>, <span class="pl-s1">verbose</span><span class="pl-c1">=</span><span class="pl-c1">1</span>, <span class="pl-s1">callbacks</span><span class="pl-c1">=</span><span class="pl-s1">my_callbacks</span>, <span class="pl-s1">validation_data</span><span class="pl-c1">=</span>(<span class="pl-v">X_test</span>, <span class="pl-s1">y_test</span>))
<span class="pl-c">#   Get loss and accuracy on test data</span>
<span class="pl-s1">eval_result</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-en">evaluate</span>(<span class="pl-v">X_test</span>, <span class="pl-s1">y_test</span>)
<span class="pl-c">#   Print test accuracy</span>
<span class="pl-en">print</span>(<span class="pl-s">"<span class="pl-cce">\n</span><span class="pl-cce">\n</span>Test loss:"</span>, <span class="pl-s1">eval_result</span>[<span class="pl-c1">0</span>], <span class="pl-s">"Test accuracy:"</span>, <span class="pl-s1">eval_result</span>[<span class="pl-c1">1</span>])
<span class="pl-c">#   Plot the decision boundary</span>
<span class="pl-en">plot_decision_boundary</span>(<span class="pl-s1">model</span>, <span class="pl-v">X</span>, <span class="pl-s1">y</span>).<span class="pl-en">show</span>()</pre></div>
<p dir="auto">There's already a duplicate of this issue but it was closed without a fix: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="424593599" data-permission-text="Title is private" data-url="https://github.com/keras-team/keras/issues/12538" data-hovercard-type="issue" data-hovercard-url="/keras-team/keras/issues/12538/hovercard" href="https://github.com/keras-team/keras/issues/12538">#12538</a></p>
<p dir="auto">I mean honestly wtf, hacking code into the Keras library without actually commiting it != a fix <g-emoji class="g-emoji" alias="smile" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png">😄</g-emoji></p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ymodak/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ymodak">@ymodak</a>, you asked for a way to reproduce this error. All this information should be enough for this.</p>
<h3 dir="auto">My environment</h3>
<p dir="auto">OS: Windows 10<br>
Python install: MiniConda with 3.6<br>
CUDA: Yes</p>
<p dir="auto">Commands I ran:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="conda create -n POMP2 python=3.6
activate POMP2

conda install tensorflow-gpu
conda install keras

conda install scikit-learn matplotlib pydot"><pre class="notranslate"><code class="notranslate">conda create -n POMP2 python=3.6
activate POMP2

conda install tensorflow-gpu
conda install keras

conda install scikit-learn matplotlib pydot
</code></pre></div>
<p dir="auto">Note:  graphviz is automatically installed.</p>
<h3 dir="auto">My investigation</h3>
<p dir="auto">I already tried to figure out what's going on and it seems that at some point a file named <code class="notranslate">dot.bat</code> is called which returned exit code 1.</p>
<p dir="auto"><code class="notranslate">Path of dot.bat: C:\Users\******\AppData\Local\conda\conda\pkgs\graphviz-2.38-hfd603c8_2\Library\bin\dot.bat</code></p>
<p dir="auto">If I check out that file it calls dot.exe<br>
<code class="notranslate">Path of dot.exe: C:\Users\********\AppData\Local\conda\conda\pkgs\graphviz-2.38-hfd603c8_2\Library\bin\graphviz\dot.exe</code></p>
<p dir="auto">When you check out the screenshot, you can see on the bottom the commands that are being used to call dot.bat:</p>
<p dir="auto"><code class="notranslate">['dot.bat', '-Tps', 'C:\\Users\\********\\AppData\\Local\\Temp\\tmpd7q3ltxy'] return code: 1</code></p>
<p dir="auto">If I however check the Temp directory to see if there's a file named <code class="notranslate">tmpd7q3ltxy</code>. There is none.</p>
<h3 dir="auto">Question</h3>
<p dir="auto">Does anyone have any idea what's going on here?</p>