code: def __init__(self, dim):
      super().__init__()
      half_dim = dim // 2
      emb = math.log(10000) / (half_dim - 1)
      self.register_buffer(
          "emb", torch.exp(torch.arange(half_dim) * -emb)
      )
  
imports: import math
  import kornia
  import torch
  import torch.nn.functional
  from einops import rearrange
  from torch import nn
label_desc: Use image node_id 1 to create a new SinusoidalPosEmb object from inherited base classes: nn with example: obj = SinusoidalPosEmb(dim)