class_docstr: Style encoder.
  
  This module is style encoder introduced in `Style Tokens: Unsupervised Style
  Modeling, Control and Transfer in End-to-End Speech Synthesis`.
  
  .. _`Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End
      Speech Synthesis`: https://arxiv.org/abs/1803.09017
  
  Args:
      idim (int, optional): Dimension of the input mel-spectrogram.
      gst_tokens (int, optional): The number of GST embeddings.
      gst_token_dim (int, optional): Dimension of each GST embedding.
      gst_heads (int, optional): The number of heads in GST multihead attention.
      conv_layers (int, optional): The number of conv layers in the reference encoder.
      conv_chans_list: (Sequence[int], optional):
          List of the number of channels of conv layers in the referece encoder.
      conv_kernel_size (int, optional):
          Kernel size of conv layers in the reference encoder.
      conv_stride (int, optional):
          Stride size of conv layers in the reference encoder.
      gru_layers (int, optional): The number of GRU layers in the reference encoder.
      gru_units (int, optional): The number of GRU units in the reference encoder.
  
  Todo:
      * Support manual weight specification in inference.
class_docstr_tok: ["Style","encoder",".","This","module","is","style","encoder","introduced","in","`","Style","Tokens",":","Unsupervised","Style","Modeling",",","Control","and","Transfer","in","End-to-End","Speech","Synthesis","`",".","..","_","`","Style","Tokens",":","Unsupervised","Style","Modeling",",","Control","and","Transfer","in","End-to-End","Speech","Synthesis","`",":","https",":","\/\/arxiv.org\/abs\/1803.09017","Args",":","idim","(","int",",","optional",")",":","Dimension","of","the","input","mel-spectrogram",".","gst_tokens","(","int",",","optional",")",":","The","number","of","GST","embeddings",".","gst_token_dim","(","int",",","optional",")",":","Dimension","of","each","GST","embedding",".","gst_heads","(","int",",","optional",")",":","The","number","of","heads","in","GST","multihead","attention",".","conv_layers","(","int",",","optional",")",":","The","number","of","conv","layers","in","the","reference","encoder",".","conv_chans_list",":","(","Sequence","[","int","]",",","optional",")",":","List","of","the","number","of","channels","of","conv","layers","in","the","referece","encoder",".","conv_kernel_size","(","int",",","optional",")",":","Kernel","size","of","conv","layers","in","the","reference","encoder",".","conv_stride","(","int",",","optional",")",":","Stride","size","of","conv","layers","in","the","reference","encoder",".","gru_layers","(","int",",","optional",")",":","The","number","of","GRU","layers","in","the","reference","encoder",".","gru_units","(","int",",","optional",")",":","The","number","of","GRU","units","in","the","reference","encoder",".","Todo",":","*","Support","manual","weight","specification","in","inference","."]
docstr: Calculate forward propagation.
  
  Args:
      speech (Tensor): Batch of padded target features (B, Lmax, odim).
  
  Returns:
      Tensor: Style token embeddings (B, token_dim).
docstr_tok: ["Calculate","forward","propagation",".","Args",":","speech","(","Tensor",")",":","Batch","of","padded","target","features","(","B",",","Lmax",",","odim",")",".","Returns",":","Tensor",":","Style","token","embeddings","(","B",",","token_dim",")","."]
code: def forward(self, speech: torch.Tensor) -> torch.Tensor:
      """Calculate forward propagation.
  
      Args:
          speech (Tensor): Batch of padded target features (B, Lmax, odim).
  
      Returns:
          Tensor: Style token embeddings (B, token_dim).
  
      """
      ref_embs = self.ref_enc(speech)
      style_embs = self.stl(ref_embs)
  
      return style_embs
  
file_path: espnet/espnet2/tts/gst/style_encoder.py
imports: from typing import Sequence
  import torch
  from typeguard import check_argument_types
  from espnet.nets.pytorch_backend.transformer.attention import MultiHeadedAttention
label_desc: Use image node_id 2 for calling the StyleEncoder obj's underlying member method code with example usage: obj.forward(speech) and returns: style_embs