code: def timestep_embedding(timesteps, dim, max_period=10000):
      r"""
      Create sinusoidal timestep embeddings.
  
      :param timesteps: a 1-D Tensor of N indices, one per batch element.
                        These may be fractional. (N,)
      :param dim: the dimension of the output.
      :param max_period: controls the minimum frequency of the embeddings.
      :return: an [N x dim] Tensor of positional embeddings.
      """
  
      half = dim // 2
      freqs = torch.exp(
          -math.log(max_period)
          * torch.arange(start=0, end=half, dtype=torch.float32)
          / half
      ).to(
          timesteps.device
      )  # shape (dim//2,)
      args = timesteps[:, None].float() * freqs[None]  # (N, dim//2)
      embedding = torch.cat(
          [torch.cos(args), torch.sin(args)], dim=-1
      )  # (N, (dim//2)*2)
      if dim % 2:
          # zero pad in the last dimension to ensure shape (N, dim)
          embedding = torch.cat(
              [embedding, torch.zeros_like(embedding[:, :1])], dim=-1
          )
      return embedding
  
imports: import enum
  import math
  import copy
  import numpy
  import torch
  import torch.nn.functional
  import torch.nn
  from recbole.model.init import xavier_normal_initialization
  from recbole.utils.enum_type import InputType
  from recbole.model.abstract_recommender import AutoEncoderMixin, GeneralRecommender
  from recbole.model.layers import MLPLayers
  import typing
label_desc: Use image node_id 5 for calling a global function with example usage: timestep_embedding(timesteps, dim, max_period) and returns: embedding