class_docstr: Token-based (input/output is tokens) encoder-decoder model (e.g. T5 Language model.)
docstr: See megatron.model.transformer.set_input_tensor()
docstr_tok: ["See","megatron.model.transformer.set_input_tensor","(",")"]
code: def set_input_tensor(self, input_tensor):
      """See megatron.model.transformer.set_input_tensor()"""
      # This is usually handled in schedules.py but some inference code still
      # gives us non-lists or None
  
      if not isinstance(input_tensor, list):
          input_tensor = [input_tensor]
  
      if self.add_encoder and self.add_decoder:
          assert (
              len(input_tensor) == 1
          ), "input_tensor should only be length 1 for stage with both encoder and decoder"
          self.enc_dec_model.encoder.set_input_tensor(input_tensor[0])
      elif self.add_encoder:
          assert (
              len(input_tensor) == 1
          ), "input_tensor should only be length 1 for stage with only encoder"
          self.enc_dec_model.encoder.set_input_tensor(input_tensor[0])
      elif self.add_decoder:
          if len(input_tensor) == 2:
              self.enc_dec_model.decoder.set_input_tensor(
                  input_tensor[0]
              )
              self.enc_dec_model.encoder_hidden_state = input_tensor[1]
          elif len(input_tensor) == 1:
              self.enc_dec_model.decoder.set_input_tensor(None)
              self.enc_dec_model.encoder_hidden_state = input_tensor[0]
          else:
              raise Exception(
                  "input_tensor must have either length 1 or 2"
              )
      else:
          raise Exception(
              "Stage must have at least either encoder or decoder"
          )
  
imports: import torch
  from omegaconf import DictConfig
  from nemo.collections.nlp.modules.common.megatron.adapters.parallel_adapters import AdapterName, PromptEncoderAdapterConfig
  from nemo.collections.nlp.modules.common.megatron.hiddens import get_hiddens_module
  from nemo.collections.nlp.modules.common.megatron.language_model import Embedding
  from nemo.collections.nlp.modules.common.megatron.layer_type import LayerType
  from nemo.collections.nlp.modules.common.megatron.megatron_decoders import get_decoder_model
  from nemo.collections.nlp.modules.common.megatron.megatron_encoder_decoder import MegatronTransformerEncoderDecoderModule
  from nemo.collections.nlp.modules.common.megatron.megatron_encoders import get_encoder_model
  from nemo.collections.nlp.modules.common.megatron.module import MegatronModule
  from nemo.collections.nlp.modules.common.megatron.position_embedding import ALiBiRelativePositionEmbedding, KERPLERelativePositionEmbedding, T5RelativePositionEmbedding
  from nemo.collections.nlp.modules.common.megatron.utils import ApexGuardDefaults, build_position_ids, init_method_normal, parallel_lm_logits, scaled_init_method_normal
  from nemo.collections.nlp.modules.common.megatron.vocab_parallel_cross_entropy import vocab_parallel_cross_entropy
  from nemo.core.classes.mixins import adapter_mixins
label_desc: Use image node_id 6 for calling the MegatronTokenLevelEncoderDecoderModule obj's underlying member method code with example usage: obj.set_input_tensor(input_tensor) without return types