class_docstr: Implementaion of Deep AR model
class_docstr_tok: ["Implementaion","of","Deep","AR","model"]
code: def unroll_encoder(
      self, past, past_timestamp, future_timestamp, future=None
  ):
      if future_timestamp is None or future is None:
          time_features = past_timestamp[
              :, (self.n_past - self.n_context) :, :
          ]
          sequence = past
          sequence_length = self.n_past
          subsequences_length = self.n_context
      else:
          time_features = torch.cat(
              (
                  past_timestamp[
                      :, (self.n_past - self.n_context) :, :
                  ],
                  future_timestamp,
              ),
              dim=1,
          )
          sequence = torch.cat((past, future), dim=1)
          sequence_length = self.n_past + self.max_forecast_steps
          subsequences_length = self.n_context + self.max_forecast_steps
  
      lags = self.get_lagged_subsequences(
          sequence=sequence,
          sequence_length=sequence_length,
          indices=self.lags_seq,
          subsequences_length=subsequences_length,
      )
  
      input_lags = lags.reshape(
          (
              -1,
              subsequences_length,
              len(self.lags_seq) * self.output_size,
          )
      )
      rnn_inputs = torch.cat((input_lags, time_features), dim=-1)
      outputs, states = self.rnn(rnn_inputs)
  
      return outputs, states
  
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 3 for calling the DeepARModel obj's underlying member method code with example usage: obj.unroll_encoder(past, past_timestamp, future_timestamp, future) and returns: outputs,  states