title: KerasClassifier fails to fit model, despite everything working fine otherwise
body: <p>I'm trying to use a <code>KerasClassifier</code> wrapper in order to make my workflow
  scikit-friendly. However, when I try to use it with the following function, it
  gives an error; training the model using native Keras model <code>fit()</code> works.
  (this is Tensorflow 2.2.0, running in a conda environment)</p>
  <pre class="lang-py prettyprint-override"><code>def model_arch(n_features: int):
      i = tf.keras.layers.Input(shape=(n_features,))
  
      hidden_dense = tf.keras.layers.Dense(64)(i)
      hidden_dense = tf.keras.layers.BatchNormalization()(hidden_dense)
      hidden_dense = tf.keras.layers.Activation(tf.nn.tanh)(hidden_dense)
  
      o = tf.keras.layers.Dense(1)(hidden_dense)
      o = tf.keras.layers.BatchNormalization()(o)
      o = tf.keras.layers.Activation(&quot;sigmoid&quot;)(o)
  
      classifier = tf.keras.models.Model(inputs=i, outputs=o)
  
      opt = tf.keras.optimizers.SGD(lr=1e-3, decay=1e-6, momentum=0.9, nesterov=True)
      classifier.compile(
          loss=&quot;binary_crossentropy&quot;,
          optimizer=opt,
          metrics=[&quot;accuracy&quot;],
      )
      
      return classifier
  </code></pre>
  <p>The following works:</p>
  <pre class="lang-py prettyprint-override"><code>X = np.random.random((100,3))
  y = np.random.random((100,)) # 'y' is a binary vector in reality
  
  clf = model_arch(3)
  clf.fit(X, y, epochs=10)
  </code></pre>
  <p>However, when I try to use <code>KerasClassifier</code> wrapper, I get an error:</p>
  <pre class="lang-py prettyprint-override"><code>clf = KerasClassifier(model_arch(3), epochs=10)
  clf.fit(X, y)
  
  # ValueError: The first argument to `Layer.call` must always be passed.
  </code></pre>
  <p>Every example I have seen on the internet seems to do the same as I: define a
  function that returns a compiled keras model, then pass it to the wrapper, and
  fit it or use in a pipeline. The only difference I notice is that most (if not
  all) examples use the <code>Sequential</code> API instead of the functional API, but afaik
  that should not be a problem, right?</p>
  <p>Tensorflow documentation doesn't seem to give any example of what kind of
  function we should pass to the wrapper, but since every example uses one similar
  to mine, I think that's correct.</p>
  <p>Can anyone shed some light? Thanks.</p>
  <p><strong>EDIT</strong> (after comments):</p>
  <p>I import the KerasClassifier like this:</p>
  <pre class="lang-py prettyprint-override"><code>from tensorflow.keras.wrappers.scikit_learn import KerasClassifier
  </code></pre>
  <p>Error log:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/home/adrian/miniconda3/envs/kaggle/lib/python3.8/site-packages/tensorflow/python/keras/wrappers/scikit_learn.py&quot;, line 223, in fit
      return super(KerasClassifier, self).fit(x, y, **kwargs)
    File &quot;/home/adrian/miniconda3/envs/kaggle/lib/python3.8/site-packages/tensorflow/python/keras/wrappers/scikit_learn.py&quot;, line 154, in fit
      self.model = self.build_fn(
    File &quot;/home/adrian/miniconda3/envs/kaggle/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py&quot;, line 799, in __call__
      raise ValueError(
  ValueError: The first argument to `Layer.call` must always be passed.
  </code></pre>