class_docstr: Classification model following the pattern of tensorizer + encoder.
class_docstr_tok: ["Classification","model","following","the","pattern","of","tensorizer","+","encoder","."]
code: def forward(
      self, encoder_inputs: Tuple[torch.Tensor, ...], *args
  ) -> List[torch.Tensor]:
      if self.encoder.output_encoded_layers:
          # if encoded layers are returned, discard them
          representation = self.encoder(encoder_inputs)[1]
      else:
          representation = self.encoder(encoder_inputs)[0]
      return self.decoder(representation, *args)
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn
  from pytext.common.constants import Stage
  from pytext.config.component import create_loss
  from pytext.data.bert_tensorizer import BERTTensorizer, BERTTensorizerBase
  from pytext.data.dense_retrieval_tensorizer import BERTContextTensorizerForDenseRetrieval, PositiveLabelTensorizerForDenseRetrieval
  from pytext.data.tensorizers import FloatListTensorizer, LabelTensorizer, NtokensTensorizer, Tensorizer
  from pytext.loss import BinaryCrossEntropyLoss, MultiLabelSoftMarginLoss
  from pytext.models.decoders.mlp_decoder import MLPDecoder
  from pytext.models.model import BaseModel, ModelInputBase
  from pytext.models.module import create_module
  from pytext.models.output_layers import ClassificationOutputLayer
  from pytext.models.output_layers.doc_classification_output_layer import BinaryClassificationOutputLayer, MulticlassOutputLayer, MultiLabelOutputLayer
  from pytext.models.pair_classification_model import BasePairwiseModel
  from pytext.models.representations.huggingface_bert_sentence_encoder import HuggingFaceBertSentenceEncoder
  from pytext.models.representations.huggingface_electra_sentence_encoder import HuggingFaceElectraSentenceEncoder
  from pytext.models.representations.representation_base import RepresentationBase
  from pytext.models.representations.transformer_sentence_encoder_base import TransformerSentenceEncoderBase
  from pytext.torchscript.module import ScriptPyTextEmbeddingModuleIndex, ScriptPyTextEmbeddingModuleWithDenseIndex
  from pytext.torchscript.utils import ScriptBatchInput, squeeze_1d, squeeze_2d
  from pytext.utils.label import get_label_weights
  from pytext.utils.usage import log_class_usage
label_desc: Use image node_id 3 for calling the _EncoderBaseModel obj's underlying member method code with example usage: obj.forward(encoder_inputs) and returns: self