MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / __init__

Method __init__

diffusers/src/diffusers/models/normalization.py:44–65  ·  view source on GitHub ↗
(
        self,
        embedding_dim: int,
        num_embeddings: Optional[int] = None,
        output_dim: Optional[int] = None,
        norm_elementwise_affine: bool = False,
        norm_eps: float = 1e-5,
        chunk_dim: int = 0,
    )

Source from the content-addressed store, hash-verified

42 """
43
44 def __init__(
45 self,
46 embedding_dim: int,
47 num_embeddings: Optional[int] = None,
48 output_dim: Optional[int] = None,
49 norm_elementwise_affine: bool = False,
50 norm_eps: float = 1e-5,
51 chunk_dim: int = 0,
52 ):
53 super().__init__()
54
55 self.chunk_dim = chunk_dim
56 output_dim = output_dim or embedding_dim * 2
57
58 if num_embeddings is not None:
59 self.emb = nn.Embedding(num_embeddings, embedding_dim)
60 else:
61 self.emb = None
62
63 self.silu = nn.SiLU()
64 self.linear = nn.Linear(embedding_dim, output_dim)
65 self.norm = nn.LayerNorm(output_dim // 2, norm_eps, norm_elementwise_affine)
66
67 def forward(
68 self, x: torch.Tensor, timestep: Optional[torch.Tensor] = None, temb: Optional[torch.Tensor] = None

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected