class_docstr: Emformer-based recurrent neural network transducer (RNN-T) encoder (transcription network).
  
  Args:
      input_dim (int): feature dimension of each input sequence element.
      output_dim (int): feature dimension of each output sequence element.
      segment_length (int): length of input segment expressed as number of frames.
      right_context_length (int): length of right context expressed as number of frames.
      time_reduction_input_dim (int): dimension to scale each element in input sequences to
          prior to applying time reduction block.
      time_reduction_stride (int): factor by which to reduce length of input sequence.
      transformer_num_heads (int): number of attention heads in each Emformer layer.
      transformer_ffn_dim (int): hidden layer dimension of each Emformer layer's feedforward network.
      transformer_num_layers (int): number of Emformer layers to instantiate.
      transformer_left_context_length (int): length of left context.
      transformer_dropout (float, optional): transformer dropout probability. (Default: 0.0)
      transformer_activation (str, optional): activation function to use in each Emformer layer's
          feedforward network. Must be one of ("relu", "gelu", "silu"). (Default: "relu")
      transformer_max_memory_size (int, optional): maximum number of memory elements to use. (Default: 0)
      transformer_weight_init_scale_strategy (str, optional): per-layer weight initialization scaling
          strategy. Must be one of ("depthwise", "constant", ``None``). (Default: "depthwise")
      transformer_tanh_on_mem (bool, optional): if ``True``, applies tanh to memory elements. (Default: ``False``)
class_docstr_tok: ["Emformer-based","recurrent","neural","network","transducer","(","RNN-T",")","encoder","(","transcription","network",")",".","Args",":","input_dim","(","int",")",":","feature","dimension","of","each","input","sequence","element",".","output_dim","(","int",")",":","feature","dimension","of","each","output","sequence","element",".","segment_length","(","int",")",":","length","of","input","segment","expressed","as","number","of","frames",".","right_context_length","(","int",")",":","length","of","right","context","expressed","as","number","of","frames",".","time_reduction_input_dim","(","int",")",":","dimension","to","scale","each","element","in","input","sequences","to","prior","to","applying","time","reduction","block",".","time_reduction_stride","(","int",")",":","factor","by","which","to","reduce","length","of","input","sequence",".","transformer_num_heads","(","int",")",":","number","of","attention","heads","in","each","Emformer","layer",".","transformer_ffn_dim","(","int",")",":","hidden","layer","dimension","of","each","Emformer","layer","'s","feedforward","network",".","transformer_num_layers","(","int",")",":","number","of","Emformer","layers","to","instantiate",".","transformer_left_context_length","(","int",")",":","length","of","left","context",".","transformer_dropout","(","float",",","optional",")",":","transformer","dropout","probability",".","(","Default",":","0.0",")","transformer_activation","(","str",",","optional",")",":","activation","function","to","use","in","each","Emformer","layer's","feedforward","network",".","Must","be","one","of","(","``","relu","''",",","``","gelu","''",",","``","silu","''",")",".","(","Default",":","``","relu","''",")","transformer_max_memory_size","(","int",",","optional",")",":","maximum","number","of","memory","elements","to","use",".","(","Default",":","0",")","transformer_weight_init_scale_strategy","(","str",",","optional",")",":","per-layer","weight","initialization","scaling","strategy",".","Must","be","one","of","(","``","depthwise","''",",","``","constant","''",",","``","None","``",")",".","(","Default",":","``","depthwise","''",")","transformer_tanh_on_mem","(","bool",",","optional",")",":","if","``","True","``",",","applies","tanh","to","memory","elements",".","(","Default",":","``","False","``",")"]
docstr: Forward pass for inference.
  
  B: batch size;
  T: maximum input sequence segment length in batch;
  D: feature dimension of each input sequence frame (input_dim).
  
  Args:
      input (torch.Tensor): input frame sequence segments right-padded with right context, with
          shape `(B, T + right context length, D)`.
      lengths (torch.Tensor): with shape `(B,)` and i-th element representing
          number of valid frames for i-th batch element in ``input``.
      state (List[List[torch.Tensor]] or None): list of lists of tensors
          representing internal state generated in preceding invocation
          of ``infer``.
  
  Returns:
      (torch.Tensor, torch.Tensor, List[List[torch.Tensor]]):
          torch.Tensor
              output frame sequences, with
              shape `(B, T // time_reduction_stride, output_dim)`.
          torch.Tensor
              output input lengths, with shape `(B,)` and i-th element representing
              number of valid elements for i-th batch element in output.
          List[List[torch.Tensor]]
              output states; list of lists of tensors
              representing internal state generated in current invocation
              of ``infer``.
docstr_tok: ["Forward","pass","for","inference",".","B",":","batch","size",";","T",":","maximum","input","sequence","segment","length","in","batch",";","D",":","feature","dimension","of","each","input","sequence","frame","(","input_dim",")",".","Args",":","input","(","torch.Tensor",")",":","input","frame","sequence","segments","right-padded","with","right","context",",","with","shape","`","(","B",",","T","+","right","context","length",",","D",")","`",".","lengths","(","torch.Tensor",")",":","with","shape","`","(","B",",",")","`","and","i-th","element","representing","number","of","valid","frames","for","i-th","batch","element","in","``","input","``",".","state","(","List","[","List","[","torch.Tensor","]","]","or","None",")",":","list","of","lists","of","tensors","representing","internal","state","generated","in","preceding","invocation","of","``","infer","``",".","Returns",":","(","torch.Tensor",",","torch.Tensor",",","List","[","List","[","torch.Tensor","]","]",")",":","torch.Tensor","output","frame","sequences",",","with","shape","`","(","B",",","T","\/\/","time_reduction_stride",",","output_dim",")","`",".","torch.Tensor","output","input","lengths",",","with","shape","`","(","B",",",")","`","and","i-th","element","representing","number","of","valid","elements","for","i-th","batch","element","in","output",".","List","[","List","[","torch.Tensor","]","]","output","states",";","list","of","lists","of","tensors","representing","internal","state","generated","in","current","invocation","of","``","infer","``","."]
code: def infer(
      self,
      input: torch.Tensor,
      lengths: torch.Tensor,
      states: Optional[List[List[torch.Tensor]]],
  ) -> Tuple[torch.Tensor, torch.Tensor, List[List[torch.Tensor]]]:
      r"""Forward pass for inference.
  
      B: batch size;
      T: maximum input sequence segment length in batch;
      D: feature dimension of each input sequence frame (input_dim).
  
      Args:
          input (torch.Tensor): input frame sequence segments right-padded with right context, with
              shape `(B, T + right context length, D)`.
          lengths (torch.Tensor): with shape `(B,)` and i-th element representing
              number of valid frames for i-th batch element in ``input``.
          state (List[List[torch.Tensor]] or None): list of lists of tensors
              representing internal state generated in preceding invocation
              of ``infer``.
  
      Returns:
          (torch.Tensor, torch.Tensor, List[List[torch.Tensor]]):
              torch.Tensor
                  output frame sequences, with
                  shape `(B, T // time_reduction_stride, output_dim)`.
              torch.Tensor
                  output input lengths, with shape `(B,)` and i-th element representing
                  number of valid elements for i-th batch element in output.
              List[List[torch.Tensor]]
                  output states; list of lists of tensors
                  representing internal state generated in current invocation
                  of ``infer``.
      """
      input_linear_out = self.input_linear(input)
      time_reduction_out, time_reduction_lengths = self.time_reduction(
          input_linear_out, lengths
      )
      (
          transformer_out,
          transformer_lengths,
          transformer_states,
      ) = self.transformer.infer(
          time_reduction_out, time_reduction_lengths, states
      )
      output_linear_out = self.output_linear(transformer_out)
      layer_norm_out = self.layer_norm(output_linear_out)
      return layer_norm_out, transformer_lengths, transformer_states
  
imports: from abc import ABC, abstractmethod
  from typing import List, Optional, Tuple
  import torch
  from torchaudio.models import Emformer
label_desc: Use image node_id 3 for calling the _EmformerEncoder obj's underlying member method code with example usage: obj.infer(input, lengths, states) and returns: layer_norm_out,  transformer_lengths,  transformer_states