parameters: (self, model, features, mode)
return_statement: return ModelOutputs(
          loss=loss_op,
          end_state=nest.pack_sequence_as(end_state, last_end_state_flat),
          predictions=batch_predictions,
          prediction_times=features[feature_keys.TrainEvalFeatures.TIMES])
docstring: Feeds end state from one training iteration into the next.
  
      Args:
        model: The model to wrap. Compatible with children of TimeSeriesModel.
        features: Dictionary with Tensor values defining the data to be
          processed. The expected key/value pairs are at minimum:
            feature_keys.TrainEvalFeatures.TIMES: A [number of chunks x window
              size] Tensor with times for each observation, the result of chunking
              a single longer time series.
            feature_keys.TrainEvalFeatures.VALUES: A [number of chunks x window
              size x num features] Tensor with values for each observation,
              corresponding to times.
        mode: The tf.estimator.ModeKeys mode to use. For EVAL and INFER, no
            batching is performed, which may be slow. This is to avoid giving
            cached and almost certainly stale values.
      Returns:
        A ModelOutputs object.
      Raises:
        ValueError: If initialize_graph has not been called.
docstring_summary: Feeds end state from one training iteration into the next.
docstring_tokens: Feeds end state from one training iteration into the next .
function: def _define_loss_with_saved_state(self, model, features, mode):
      """Feeds end state from one training iteration into the next.
  
      Args:
        model: The model to wrap. Compatible with children of TimeSeriesModel.
        features: Dictionary with Tensor values defining the data to be
          processed. The expected key/value pairs are at minimum:
            feature_keys.TrainEvalFeatures.TIMES: A [number of chunks x window
              size] Tensor with times for each observation, the result of chunking
              a single longer time series.
            feature_keys.TrainEvalFeatures.VALUES: A [number of chunks x window
              size x num features] Tensor with values for each observation,
              corresponding to times.
        mode: The tf.estimator.ModeKeys mode to use. For EVAL and INFER, no
            batching is performed, which may be slow. This is to avoid giving
            cached and almost certainly stale values.
      Returns:
        A ModelOutputs object.
      Raises:
        ValueError: If initialize_graph has not been called.
      """
      if not self._graph_initialized:
        raise ValueError("ChainingStateManager requires initialize_graph() to be "
                         "called before use.")
      (loss_op, end_state, batch_predictions) = self._update_cached_states(
          model=model,
          features=features,
          mode=mode)
      # Add a batch dimension so state can be used directly (e.g. for predictions)
      # without the user manually reshaping it.
      last_end_state_flat = [end_state_value[-1][None]
                             for end_state_value in nest.flatten(end_state)]
      batch_predictions["observed"] = features[
          feature_keys.TrainEvalFeatures.VALUES]
      return ModelOutputs(
          loss=loss_op,
          end_state=nest.pack_sequence_as(end_state, last_end_state_flat),
          predictions=batch_predictions,
          prediction_times=features[feature_keys.TrainEvalFeatures.TIMES])
function_tokens: def _define_loss_with_saved_state ( self , model , features , mode ) : if not self . _graph_initialized : raise ValueError ( "ChainingStateManager requires initialize_graph() to be " "called before use." ) ( loss_op , end_state , batch_predictions ) = self . _update_cached_states ( model = model , features = features , mode = mode ) # Add a batch dimension so state can be used directly (e.g. for predictions) # without the user manually reshaping it. last_end_state_flat = [ end_state_value [ - 1 ] [ None ] for end_state_value in nest . flatten ( end_state ) ] batch_predictions [ "observed" ] = features [ feature_keys . TrainEvalFeatures . VALUES ] return ModelOutputs ( loss = loss_op , end_state = nest . pack_sequence_as ( end_state , last_end_state_flat ) , predictions = batch_predictions , prediction_times = features [ feature_keys . TrainEvalFeatures . TIMES ] )