'Called at the end of a batch.
# Arguments
batch: integer, index of batch within the current epoch.
logs: dictionary of logs.'

def on_batch_end(self, batch, logs=None):

    logs = (logs or {})
    if (not hasattr(self, '_t_enter_batch')):
        self._t_enter_batch = time.time()
    self._delta_t_batch = (time.time() - self._t_enter_batch)
    t_before_callbacks = time.time()
    for callback in self.callbacks:
        callback.on_batch_end(batch, logs)
    self._delta_ts_batch_end.append((time.time() - t_before_callbacks))
    delta_t_median = np.median(self._delta_ts_batch_end)
    if ((self._delta_t_batch > 0.0) and ((delta_t_median > (0.95 * self._delta_t_batch)) and (delta_t_median > 0.1))):
        warnings.warn(('Method    on_batch_end()    is    slow    compared    to    the    batch    update    (%f).    Check    your    callbacks.' % delta_t_median))
