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

Method __init__

diffusers/src/diffusers/models/embeddings.py:1299–1307  ·  view source on GitHub ↗
(self, num_heads, embed_dim, dtype=None)

Source from the content-addressed store, hash-verified

1297 # Copied from https://github.com/deep-floyd/IF/blob/2f91391f27dd3c468bf174be5805b4cc92980c0b/deepfloyd_if/model/nn.py#L54
1298
1299 def __init__(self, num_heads, embed_dim, dtype=None):
1300 super().__init__()
1301 self.dtype = dtype
1302 self.positional_embedding = nn.Parameter(torch.randn(1, embed_dim) / embed_dim**0.5)
1303 self.k_proj = nn.Linear(embed_dim, embed_dim, dtype=self.dtype)
1304 self.q_proj = nn.Linear(embed_dim, embed_dim, dtype=self.dtype)
1305 self.v_proj = nn.Linear(embed_dim, embed_dim, dtype=self.dtype)
1306 self.num_heads = num_heads
1307 self.dim_per_head = embed_dim // self.num_heads
1308
1309 def forward(self, x):
1310 bs, length, width = x.size()

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected