class_docstr: Implementaion of Deep AR model
class_docstr_tok: ["Implementaion","of","Deep","AR","model"]
code: def sampling_decoder(self, past, time_features, begin_states):
      repeated_past = past.repeat_interleave(
          repeats=self.num_prediction_samples,
          dim=0,
      )
  
      repeated_time_features = time_features.repeat_interleave(
          repeats=self.num_prediction_samples, dim=0
      )
  
      repeated_states = [
          s.repeat_interleave(
              repeats=self.num_prediction_samples, dim=1
          )
          for s in begin_states
      ]
  
      future_samples = []
  
      for k in range(self.max_forecast_steps):
          lags = self.get_lagged_subsequences(
              sequence=repeated_past,
              sequence_length=self.n_past + k,
              indices=self.shifted_lags,
              subsequences_length=1,
          )
          input_lags = lags.reshape(
              -1, 1, len(self.lags_seq) * self.output_size
          )
  
          decoder_input = torch.cat(
              (input_lags, repeated_time_features[:, k : k + 1, :]),
              dim=-1,
          )
          rnn_outputs, repeated_states = self.rnn(
              decoder_input, repeated_states
          )
  
          distr_proj_out = self.distr_proj(rnn_outputs)
  
          mu, log_sigma = torch.split(
              distr_proj_out, self.config.dim, dim=-1
          )
          sigma = torch.log(1 + torch.exp(log_sigma)) + 1e-07
  
          new_samples = (
              mu
              + torch.randn_like(
                  mu, dtype=torch.float, device=self.device
              )
              * sigma
          )
  
          repeated_past = torch.cat((repeated_past, new_samples), dim=1)
          future_samples.append(new_samples)
  
      samples = torch.cat(future_samples, dim=1)
  
      return samples.reshape(
          (
              -1,
              self.num_prediction_samples,
              self.max_forecast_steps,
              self.output_size,
          )
      )
  
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 5 for calling the DeepARModel obj's underlying member method code with example usage: obj.sampling_decoder(past, time_features, begin_states) and returns: samples