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 __init__(self, seq_len: int, activation: str, **kwargs):
      super().__init__(**kwargs)
      self.w0 = nn.parameter.Parameter(torch.randn(seq_len, 1))
      self.b0 = nn.parameter.Parameter(torch.randn(1))
      self.w = nn.parameter.Parameter(torch.randn(seq_len, 1))
      self.b = nn.parameter.Parameter(torch.randn(1))
  
      if activation == "sin":
          self.f = torch.sin
      elif activation == "cos":
          self.f = torch.cos
      else:
          raise ValueError(
              f"Activation {activation} is not supported yet."
          )
  
      self.fc = nn.Linear(2, seq_len)
  
imports: import torch
  from torch import nn
label_desc: Use image node_id 1 to create a new Time2Vec object from inherited base classes: nn with example: obj = Time2Vec(seq_len, activation)