class_docstr: Diffusion-Step embedding as in DiffWave / Vaswani et al. 2017.
class_docstr_tok: ["Diffusion-Step","embedding","as","in","DiffWave","\/","Vaswani","et","al",".","2017","."]
code: def forward(self, t):
      fac = 10 ** (
          4
          * torch.arange(self.embed_dim, device=t.device)
          / (self.embed_dim - 1)
      )
      inner = t[:, None] * fac[None, :]
      if self.complex_valued:
          return torch.exp(1j * inner)
      else:
          return torch.cat([torch.sin(inner), torch.cos(inner)], dim=-1)
  
imports: import functools
  from functools import partial
  import numpy
  import torch
  from torch import Tensor, nn
  from torch.nn.modules.batchnorm import _BatchNorm
label_desc: Use image node_id 2 for calling the DiffusionStepEmbedding obj's underlying member method code with example usage: obj.forward(t) and returns: torch, torch