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 __init__(self, embed_dim, complex_valued=False):
      super().__init__()
      self.complex_valued = complex_valued
      if not complex_valued:
          # If the output is real-valued, we concatenate sin+cos of the features to
          # avoid ambiguities. Therefore, in this case the effective embed_dim is cut
          # in half. For the complex-valued case, we use complex numbers which each
          # represent sin+cos directly, so the ambiguity is avoided directly,
          # and this halving is not necessary.
          embed_dim = embed_dim // 2
      self.embed_dim = embed_dim
  
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 1 to create a new DiffusionStepEmbedding object from inherited base classes: nn with example: obj = DiffusionStepEmbedding(embed_dim, complex_valued)