'Single gradient update over one batch of samples.
# Arguments
x: input data, as a Numpy array or list of Numpy arrays
(if the model has multiple inputs).
y: labels, as a Numpy array.
class_weight: dictionary mapping classes to a weight value,
used for scaling the loss function (during training only).
sample_weight: sample weights, as a Numpy array.
# Returns
Scalar training loss (if the model has no metrics)
or list of scalars (if the model computes other metrics).
The attribute `model.metrics_names` will give you
the display labels for the scalar outputs.
# Raises
RuntimeError: if the model was never compiled.'

def train_on_batch(self, x, y, class_weight=None, sample_weight=None):

    if (not self.built):
        raise RuntimeError('The    model    needs    to    be    compiled    before    being    used.')
    return self.model.train_on_batch(x, y, sample_weight=sample_weight, class_weight=class_weight)
