class_docstr: Implementaion of Deep AR model forecaster
class_docstr_tok: ["Implementaion","of","Deep","AR","model","forecaster"]
code: def _get_batch_model_loss_and_outputs(self, batch):
      config = self.config
      past, past_timestamp, future, future_timestamp = batch
  
      model_output = self.deep_model(
          past, past_timestamp, future_timestamp
      )
  
      if future is None:
          return None, model_output, None
  
      # Calcuating the loss with maximum likelihood,
      # which is seperate from the sampling procedure of deep AR models
      loss = self.deep_model.calculate_loss(
          past, past_timestamp, future, future_timestamp
      )
  
      if self.target_seq_index is not None:
          future = future[
              :, :, self.target_seq_index : self.target_seq_index + 1
          ]
  
      return loss, model_output, future
  
imports: import copy
  import logging
  import math
  import numpy
  import pandas
  from typing import List, Optional, Tuple, Union
  from merlion.utils.misc import initializer
  from merlion.models.base import NormalizingConfig
  from merlion.models.deep_base import TorchModel, LossFunction
  from merlion.models.forecast.deep_base import DeepForecasterConfig, DeepForecaster
label_desc: Use image node_id 2 for calling the DeepARForecaster obj's underlying member method code with example usage: obj._get_batch_model_loss_and_outputs(batch) and returns: loss,  model_output,  future, None,  model_output,  None