docstr: Prepares the input to the RNN and unrolls it the given number of time
  steps.
  
  Parameters
  ----------
  F
  lags
      Input lags (batch_size, sub_seq_len, target_dim, num_lags)
  scale
      Mean scale (batch_size, 1, target_dim)
  time_feat
      Additional time features
  target_dimension_indicator
      Indices of the target dimension (batch_size, target_dim)
  unroll_length
      length to unroll
  begin_state
      State to start the unrolling of the RNN
  
  Returns
  -------
  outputs
      RNN outputs (batch_size, seq_len, num_cells)
  states
      RNN states. Nested list with (batch_size, num_cells) tensors with
  dimensions target_dim x num_layers x (batch_size, num_cells)
  lags_scaled
      Scaled lags(batch_size, sub_seq_len, target_dim, num_lags)
  inputs
      inputs to the RNN
docstr_tok: ["Prepares","the","input","to","the","RNN","and","unrolls","it","the","given","number","of","time","steps",".","Parameters","--","--","--","--","--","F","lags","Input","lags","(","batch_size",",","sub_seq_len",",","target_dim",",","num_lags",")","scale","Mean","scale","(","batch_size",",","1",",","target_dim",")","time_feat","Additional","time","features","target_dimension_indicator","Indices","of","the","target","dimension","(","batch_size",",","target_dim",")","unroll_length","length","to","unroll","begin_state","State","to","start","the","unrolling","of","the","RNN","Returns","--","--","--","-","outputs","RNN","outputs","(","batch_size",",","seq_len",",","num_cells",")","states","RNN","states",".","Nested","list","with","(","batch_size",",","num_cells",")","tensors","with","dimensions","target_dim","x","num_layers","x","(","batch_size",",","num_cells",")","lags_scaled","Scaled","lags","(","batch_size",",","sub_seq_len",",","target_dim",",","num_lags",")","inputs","inputs","to","the","RNN"]
code: def unroll(
      self,
      F,
      lags: Tensor,
      scale: Tensor,
      time_feat: Tensor,
      target_dimension_indicator: Tensor,
      unroll_length: int,
      begin_state: Optional[List[Tensor]],
  ) -> Tuple[Tensor, Tensor, Tensor, Tensor]:
      """
      Prepares the input to the RNN and unrolls it the given number of time
      steps.
  
      Parameters
      ----------
      F
      lags
          Input lags (batch_size, sub_seq_len, target_dim, num_lags)
      scale
          Mean scale (batch_size, 1, target_dim)
      time_feat
          Additional time features
      target_dimension_indicator
          Indices of the target dimension (batch_size, target_dim)
      unroll_length
          length to unroll
      begin_state
          State to start the unrolling of the RNN
  
      Returns
      -------
      outputs
          RNN outputs (batch_size, seq_len, num_cells)
      states
          RNN states. Nested list with (batch_size, num_cells) tensors with
      dimensions target_dim x num_layers x (batch_size, num_cells)
      lags_scaled
          Scaled lags(batch_size, sub_seq_len, target_dim, num_lags)
      inputs
          inputs to the RNN
      """
      # (batch_size, sub_seq_len, target_dim, num_lags)
      lags_scaled = F.broadcast_div(lags, scale.expand_dims(axis=-1))
  
      assert_shape(
          lags_scaled,
          (-1, unroll_length, self.target_dim, len(self.lags_seq)),
      )
  
      input_lags = F.reshape(
          data=lags_scaled,
          shape=(
              -1,
              unroll_length,
              len(self.lags_seq) * self.target_dim,
          ),
      )
  
      # (batch_size, target_dim, embed_dim)
      index_embeddings = self.embed(target_dimension_indicator)
      assert_shape(
          index_embeddings, (-1, self.target_dim, self.embed_dim)
      )
  
      # (batch_size, seq_len, target_dim * embed_dim)
      repeated_index_embeddings = (
          index_embeddings.expand_dims(axis=1)
          .repeat(axis=1, repeats=unroll_length)
          .reshape(
              (-1, unroll_length, self.target_dim * self.embed_dim)
          )
      )
  
      # (batch_size, sub_seq_len, input_dim)
      inputs = F.concat(
          input_lags, repeated_index_embeddings, time_feat, dim=-1
      )
  
      # unroll encoder
      outputs, state = self.rnn.unroll(
          inputs=inputs,
          length=unroll_length,
          layout="NTC",
          merge_outputs=True,
          begin_state=begin_state,
      )
  
      assert_shape(outputs, (-1, unroll_length, self.num_cells))
      for s in state:
          assert_shape(s, (-1, self.num_cells))
  
      assert_shape(
          lags_scaled,
          (-1, unroll_length, self.target_dim, len(self.lags_seq)),
      )
  
      return outputs, state, lags_scaled, inputs
  
imports: from typing import List, Optional, Tuple
  import mxnet
  from gluonts.core.component import validated
  from gluonts.mx import Tensor
  from gluonts.mx.block.scaler import MeanScaler, NOPScaler
  from gluonts.mx.distribution import Distribution, DistributionOutput
  from gluonts.mx.util import assert_shape, weighted_average
label_desc: Use image node_id 3 for calling the DeepVARNetwork obj's underlying member method code with example usage: obj.unroll(F, lags, scale, time_feat, target_dimension_indicator, unroll_length, begin_state) and returns: outputs,  state,  lags_scaled,  inputs