'Runs a single gradient update on a single batch of data.
# Arguments
x: Numpy array of training data,
or list of Numpy arrays if the model has multiple inputs.
If all inputs in the model are named,
you can also pass a dictionary
mapping input names to Numpy arrays.
y: Numpy array of target data,
or list of Numpy arrays if the model has multiple outputs.
If all outputs in the model are named,
you can also pass a dictionary
mapping output names to Numpy arrays.
sample_weight: optional array of the same length as x, containing
weights to apply to the model\'s loss for each sample.
In the case of temporal data, you can pass a 2D array
with shape (samples, sequence_length),
to apply a different weight to every timestep of every sample.
In this case you should make sure to specify
sample_weight_mode="temporal" in compile().
class_weight: optional dictionary mapping
class indices (integers) to
a weight (float) to apply to the model\'s loss for the samples
from this class during training.
This can be useful to tell the model to "pay more attention" to
samples from an under-represented class.
# Returns
Scalar training loss
(if the model has a single output and no metrics)
or list of scalars (if the model has multiple outputs
and/or metrics). The attribute `model.metrics_names` will give you
the display labels for the scalar outputs.'

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

    (x, y, sample_weights) = self._standardize_user_data(x, y, sample_weight=sample_weight, class_weight=class_weight, check_batch_axis=True)
    if (self.uses_learning_phase and (not isinstance(K.learning_phase(), int))):
        ins = (((x + y) + sample_weights) + [1.0])
    else:
        ins = ((x + y) + sample_weights)
    self._make_train_function()
    outputs = self.train_function(ins)
    if (len(outputs) == 1):
        return outputs[0]
    return outputs
