class_docstr: Time2Vec implementaion in Pytorch.
  
  Args:
      seq_len (`int`):
          the length of input sequence
      activation (`str`):
          activation functions used for periodic time embedding (only support "sin" or "cos")
  
  Return:
      embedding with the same shape as input
  
  Example:
      >>> from towhee.models.layers.time2vec import Time2Vec
      >>> import torch
      >>>
      >>> x = torch.randn(3, 64)
      >>> model = Time2Vec(seq_len=64, activation="sin")
      >>> model(x).shape
      torch.Size([3, 64])
class_docstr_tok: ["Time2Vec","implementaion","in","Pytorch",".","Args",":","seq_len","(","`","int","`",")",":","the","length","of","input","sequence","activation","(","`","str","`",")",":","activation","functions","used","for","periodic","time","embedding","(","only","support","``","sin","''","or","``","cos","''",")","Return",":","embedding","with","the","same","shape","as","input","Example",":",">",">",">","from","towhee.models.layers.time2vec","import","Time2Vec",">",">",">","import","torch",">",">",">",">",">",">","x","=","torch.randn","(","3",",","64",")",">",">",">","model","=","Time2Vec","(","seq_len=64",",","activation=","''","sin","''",")",">",">",">","model","(","x",")",".shape","torch.Size","(","[","3",",","64","]",")"]
code: def forward(self, x):
      periodic = self.f(
          torch.matmul(x, self.w) + self.b
      )  # Periodic time embedding
      linear = (
          torch.matmul(x, self.w0) + self.b0
      )  # Linear time embedding
      out = torch.cat([periodic, linear], -1)  # Concat time embeddings
      out = self.fc(
          out
      )  # Convert embedding dimension back to sequence length
      return out
  
imports: import torch
  from torch import nn
label_desc: Use image node_id 2 for calling the Time2Vec obj's underlying member method code with example usage: obj.forward(x) and returns: out