class_docstr: NN Module attending to style tokens based on prosody encodings.
class_docstr_tok: ["NN","Module","attending","to","style","tokens","based","on","prosody","encodings","."]
code: def __init__(
      self,
      num_heads,
      num_style_tokens,
      gst_embedding_dim,
      d_vector_dim=None,
  ):
      super().__init__()
  
      self.query_dim = gst_embedding_dim // 2
  
      if d_vector_dim:
          self.query_dim += d_vector_dim
  
      self.key_dim = gst_embedding_dim // num_heads
      self.style_tokens = nn.Parameter(
          torch.FloatTensor(num_style_tokens, self.key_dim)
      )
      nn.init.normal_(self.style_tokens, mean=0, std=0.5)
      self.attention = MultiHeadAttention(
          query_dim=self.query_dim,
          key_dim=self.key_dim,
          num_units=gst_embedding_dim,
          num_heads=num_heads,
      )
  
file_path: TTS/TTS/tts/layers/tacotron/gst_layers.py
imports: import torch
  import torch.nn.functional
  from torch import nn
label_desc: Use image node_id 1 to create a new StyleTokenLayer object from inherited base classes: nn with example: obj = StyleTokenLayer(num_heads, num_style_tokens, gst_embedding_dim, d_vector_dim)