docstr: Creates inputs for the transformer network.
  
  All tensor arguments should have NTC layout.
docstr_tok: ["Creates","inputs","for","the","transformer","network",".","All","tensor","arguments","should","have","NTC","layout","."]
code: def create_network_input(
      self,
      F,
      feat_static_cat: Tensor,  # (batch_size, num_features)
      past_time_feat: Tensor,  # (batch_size, num_features, history_length)
      past_target: Tensor,  # (batch_size, history_length, 1)
      past_observed_values: Tensor,  # (batch_size, history_length)
      future_time_feat: Optional[
          Tensor
      ],  # (batch_size, num_features, prediction_length)
      future_target: Optional[
          Tensor
      ],  # (batch_size, prediction_length)
  ) -> Tuple[Tensor, Tensor, Tensor]:
      """
      Creates inputs for the transformer network.
  
      All tensor arguments should have NTC layout.
      """
  
      if future_time_feat is None or future_target is None:
          time_feat = past_time_feat.slice_axis(
              axis=1,
              begin=self.history_length - self.context_length,
              end=None,
          )
          sequence = past_target
          sequence_length = self.history_length
          subsequences_length = self.context_length
      else:
          time_feat = F.concat(
              past_time_feat.slice_axis(
                  axis=1,
                  begin=self.history_length - self.context_length,
                  end=None,
              ),
              future_time_feat,
              dim=1,
          )
          sequence = F.concat(past_target, future_target, dim=1)
          sequence_length = self.history_length + self.prediction_length
          subsequences_length = (
              self.context_length + self.prediction_length
          )
  
      # (batch_size, sub_seq_len, *target_shape, num_lags)
      lags = self.get_lagged_subsequences(
          F=F,
          sequence=sequence,
          sequence_length=sequence_length,
          indices=self.lags_seq,
          subsequences_length=subsequences_length,
      )
  
      # scale is computed on the context length last units of the past target
      # scale shape is (batch_size, 1, *target_shape)
      _, scale = self.scaler(
          past_target.slice_axis(
              axis=1, begin=-self.context_length, end=None
          ),
          past_observed_values.slice_axis(
              axis=1, begin=-self.context_length, end=None
          ),
      )
      embedded_cat = self.embedder(feat_static_cat)
  
      # in addition to embedding features, use the log scale as it can help
      # prediction too(batch_size, num_features + prod(target_shape))
      static_feat = F.concat(
          embedded_cat,
          F.log(scale)
          if len(self.target_shape) == 0
          else F.log(scale.squeeze(axis=1)),
          dim=1,
      )
  
      repeated_static_feat = static_feat.expand_dims(axis=1).repeat(
          axis=1, repeats=subsequences_length
      )
  
      # (batch_size, sub_seq_len, *target_shape, num_lags)
      lags_scaled = F.broadcast_div(lags, scale.expand_dims(axis=-1))
  
      # from (batch_size, sub_seq_len, *target_shape, num_lags)
      # to (batch_size, sub_seq_len, prod(target_shape) * num_lags)
      input_lags = F.reshape(
          data=lags_scaled,
          shape=(
              -1,
              subsequences_length,
              len(self.lags_seq) * prod(self.target_shape),
          ),
      )
  
      # (batch_size, sub_seq_len, input_dim)
      inputs = F.concat(
          input_lags, time_feat, repeated_static_feat, dim=-1
      )
  
      return inputs, scale, static_feat
  
imports: from typing import List, Optional, Tuple
  import mxnet
  from gluonts.core.component import validated
  from gluonts.itertools import prod
  from gluonts.mx import Tensor
  from gluonts.mx.block.feature import FeatureEmbedder
  from gluonts.mx.block.scaler import MeanScaler, NOPScaler
  from gluonts.mx.distribution import DistributionOutput
  from gluonts.mx.util import weighted_average
  from .trans_decoder import TransformerDecoder
  from .trans_encoder import TransformerEncoder
label_desc: Use image node_id 3 for calling the TransformerNetwork obj's underlying member method code with example usage: obj.create_network_input(F, feat_static_cat, past_time_feat, past_target, past_observed_values, future_time_feat, future_target) and returns: inputs,  scale,  static_feat