class_docstr: Learnable Fourier Features for Positional Encoding.
  
  See https://arxiv.org/pdf/2106.02795.pdf
  
  Args:
      d_model (int): Embedding dimension.
      dropout_rate (float): Dropout rate.
      max_len (int): Maximum input length.
      gamma (float): init parameter for the positional kernel variance
          see https://arxiv.org/pdf/2106.02795.pdf.
      apply_scaling (bool): Whether to scale the input before adding the pos encoding.
      hidden_dim (int): if not None, we modulate the pos encodings with
          an MLP whose hidden layer has hidden_dim neurons.
class_docstr_tok: ["Learnable","Fourier","Features","for","Positional","Encoding",".","See","https",":","\/\/arxiv.org\/pdf\/2106.02795.pdf","Args",":","d_model","(","int",")",":","Embedding","dimension",".","dropout_rate","(","float",")",":","Dropout","rate",".","max_len","(","int",")",":","Maximum","input","length",".","gamma","(","float",")",":","init","parameter","for","the","positional","kernel","variance","see","https",":","\/\/arxiv.org\/pdf\/2106.02795.pdf",".","apply_scaling","(","bool",")",":","Whether","to","scale","the","input","before","adding","the","pos","encoding",".","hidden_dim","(","int",")",":","if","not","None",",","we","modulate","the","pos","encodings","with","an","MLP","whose","hidden","layer","has","hidden_dim","neurons","."]
docstr: Add positional encoding.
  
  Args:
      x (torch.Tensor): Input tensor (batch, time, `*`).
  
  Returns:
      torch.Tensor: Encoded tensor (batch, time, `*`).
docstr_tok: ["Add","positional","encoding",".","Args",":","x","(","torch.Tensor",")",":","Input","tensor","(","batch",",","time",",","`","*","`",")",".","Returns",":","torch.Tensor",":","Encoded","tensor","(","batch",",","time",",","`","*","`",")","."]
code: def forward(self, x: torch.Tensor):
      """Add positional encoding.
  
      Args:
          x (torch.Tensor): Input tensor (batch, time, `*`).
  
      Returns:
          torch.Tensor: Encoded tensor (batch, time, `*`).
      """
      pe = self.extend_pe(x)
      x = x * self.xscale + pe
      return self.dropout(x)
  
imports: import math
  import torch
label_desc: Use image node_id 4 for calling the LearnableFourierPosEnc obj's underlying member method code with example usage: obj.forward(x) and returns: self