docstr: Returns lagged subsequences of a given sequence.
  Parameters
  ----------
  sequence
      the sequence from which lagged subsequences should be extracted.
      Shape: (N, T, C).
  sequence_length
      length of sequence in the T (time) dimension (axis = 1).
  indices
      list of lag indices to be used.
  subsequences_length
      length of the subsequences to be extracted.
  Returns
  --------
  lagged : Tensor
      a tensor of shape (N, S, C, I),
      where S = subsequences_length and I = len(indices),
      containing lagged subsequences.
      Specifically, lagged[i, :, j, k] = sequence[i, -indices[k]-S+j, :].
docstr_tok: ["Returns","lagged","subsequences","of","a","given","sequence",".","Parameters","--","--","--","--","--","sequence","the","sequence","from","which","lagged","subsequences","should","be","extracted",".","Shape",":","(","N",",","T",",","C",")",".","sequence_length","length","of","sequence","in","the","T","(","time",")","dimension","(","axis","=","1",")",".","indices","list","of","lag","indices","to","be","used",".","subsequences_length","length","of","the","subsequences","to","be","extracted",".","Returns","--","--","--","--","lagged",":","Tensor","a","tensor","of","shape","(","N",",","S",",","C",",","I",")",",","where","S","=","subsequences_length","and","I","=","len","(","indices",")",",","containing","lagged","subsequences",".","Specifically",",","lagged","[","i",",",":",",","j",",","k","]","=","sequence","[","i",",","-indices","[","k","]","-S+j",",",":","]","."]
code: def get_lagged_subsequences(
      F,
      sequence: Tensor,
      sequence_length: int,
      indices: List[int],
      subsequences_length: int = 1,
  ) -> Tensor:
      """
      Returns lagged subsequences of a given sequence.
      Parameters
      ----------
      sequence
          the sequence from which lagged subsequences should be extracted.
          Shape: (N, T, C).
      sequence_length
          length of sequence in the T (time) dimension (axis = 1).
      indices
          list of lag indices to be used.
      subsequences_length
          length of the subsequences to be extracted.
      Returns
      --------
      lagged : Tensor
          a tensor of shape (N, S, C, I),
          where S = subsequences_length and I = len(indices),
          containing lagged subsequences.
          Specifically, lagged[i, :, j, k] = sequence[i, -indices[k]-S+j, :].
      """
      # we must have: history_length + begin_index >= 0
      # that is: history_length - lag_index - sequence_length >= 0
      # hence the following assert
      assert max(indices) + subsequences_length <= sequence_length, (
          "lags cannot go further than history length, found lag "
          f"{max(indices)} while history length is only {sequence_length}"
      )
      assert all(lag_index >= 0 for lag_index in indices)
  
      lagged_values = []
      for lag_index in indices:
          begin_index = -lag_index - subsequences_length
          end_index = -lag_index if lag_index > 0 else None
          lagged_values.append(
              F.slice_axis(
                  sequence, axis=1, begin=begin_index, end=end_index
              ).expand_dims(axis=1)
          )
      return F.concat(
          *lagged_values, num_args=len(indices), dim=1
      ).transpose(axes=(0, 2, 3, 1))
  
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 2 for calling the DeepVARNetwork obj's underlying member method code with example usage: obj.get_lagged_subsequences(F, sequence, sequence_length, indices, subsequences_length) and returns: F