title: Keras: notImplementedError/RuntimeError when using fit_generator
body: <p>I am having troubles with keras and tensorflow, using the following code:</p>
  
  <pre><code>from tensorflow.keras.layers import Activation, Conv2D
  from tensorflow.keras import Model
  
  from data import DataGenerator
  from config import train_datapath, test_datapath
  
  
  training_generator = DataGenerator(train_datapath)
  validation_generator = DataGenerator(test_datapath)
  
  class model(Model):
      def __init__(self):
          super(model, self).__init__()
          self.conv1 = Conv2D(filters=2, kernel_size=1, strides=1, padding='same', input_shape=(256, 256, 1))
          self.act1 = Activation('relu')
  
      def call(self, input):
          """Run the model."""
          return self.act1(self.conv1(input))
  
  model = model()
  model.compile(optimizer='adam', loss='mean_squared_error')
  history = model.fit_generator(training_generator, epochs=5000, verbose=1, validation_data=(validation_generator),
                                use_multiprocessing=False)
  </code></pre>
  
  <p>Running that code gives the following error:</p>
  
  <pre><code>Using TensorFlow backend.
  Traceback (most recent call last):
    File "C:/Users/...py", line 23, in &lt;module&gt;
      use_multiprocessing=False)
    File "C:\Users\...\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\training.py", line 2161, in fit_generator
      '`fit_generator` is not yet enabled for unbuilt Model subclasses')
  NotImplementedError: `fit_generator` is not yet enabled for unbuilt Model subclasses
  </code></pre>
  
  <p>I've tried to find some hints, if I really try to do something, that isn't intended, but it's seems unlogical to me, since this way is very comfortable for defining more complex nets and since I've allready worked with pytorch, I'm pretty sure, this should work with tf and keras also.</p>
  
  <p>There is a <a href="https://stackoverflow.com/questions/50530460/notimplementederror-fit-generator-is-not-yet-enabled-for-unbuilt-model-subcla">thread</a> with the same error, but for a sequential net implementation, which ist obviously not, what I'm aiming for.</p>
  
  <p>If I'm using a direct import for keras, I'm getting a different error:</p>
  
  <pre><code>Using TensorFlow backend.
  Traceback (most recent call last):
    File "C:/Users/...py", line 23, in &lt;module&gt;
      use_multiprocessing=False)
    File "C:\Users\...\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
      return func(*args, **kwargs)
    File "C:\Users\...\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training.py", line 1418, in fit_generator
      initial_epoch=initial_epoch)
    File "C:\Users\...\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training_generator.py", line 40, in fit_generator
      model._make_train_function()
    File "C:\Users\...\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training.py", line 496, in _make_train_function
      raise RuntimeError('You must compile your model before using it.')
  RuntimeError: You must compile your model before using it.
  
  Process finished with exit code 1
  </code></pre>
  
  <p>But I'm compiling the model one row above calling the model.fit_generator() function ...
  And when I'm not completely wrong, I've also given the correct input-shape, so that shouldn't be the problem either ...</p>
  
  <p>Working with windows, python 3.6, tensorflow-gpu 1.12.</p>