class_docstr: Adapted Transformer model (https://arxiv.org/abs/1706.03762) for
  speech-to-text tasks. The Transformer encoder/decoder remains the same.
  A trainable input subsampler is prepended to the Transformer encoder to
  project inputs into the encoder dimension as well as downsample input
  sequence for computational efficiency.
class_docstr_tok: ["Adapted","Transformer","model","(","https",":","\/\/arxiv.org\/abs\/1706.03762",")","for","speech-to-text","tasks",".","The","Transformer","encoder\/decoder","remains","the","same",".","A","trainable","input","subsampler","is","prepended","to","the","Transformer","encoder","to","project","inputs","into","the","encoder","dimension","as","well","as","downsample","input","sequence","for","computational","efficiency","."]
code: def get_ctc_output(
      self,
      net_output: Tuple[
          Tensor, Optional[Dict[str, List[Optional[Tensor]]]]
      ],
      sample: Optional[Dict[str, Tensor]],
  ):
      encoder_out = net_output[1]["encoder_out"]["encoder_out"][0]
      logits = self.encoder.ctc_proj(encoder_out)  # T x B x C
      out = utils.log_softmax(logits.float(), dim=-1)
      padding_mask = net_output[1]["encoder_out"][
          "encoder_padding_mask"
      ]
      lens = out.new_full((out.shape[1],), out.shape[0]).long()
      if len(padding_mask) > 0:
          lens -= padding_mask[0].sum(dim=-1)
      return out, lens
  
imports: import logging
  import math
  from pathlib import Path
  from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn
  from torch import Tensor
  from fairseq import checkpoint_utils, utils
  from fairseq.data.data_utils import lengths_to_padding_mask
  from fairseq.models import FairseqEncoder, FairseqEncoderDecoderModel, register_model, register_model_architecture
  from fairseq.models.speech_to_text.hub_interface import S2THubInterface
  from fairseq.models.speech_to_text.modules.convolution import Conv1dSubsampler, Conv2dSubsampler
  from fairseq.models.transformer import Embedding, TransformerDecoder
  from fairseq.modules import FairseqDropout, LayerNorm, PositionalEmbedding, TransformerEncoderLayer
label_desc: Use image node_id 10 for calling the S2TTransformerModel obj's underlying member method code with example usage: obj.get_ctc_output(net_output, sample) and returns: out,  lens