MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / __init__

Method __init__

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

Source from the content-addressed store, hash-verified

575 # Copied from https://github.com/deep-floyd/IF/blob/2f91391f27dd3c468bf174be5805b4cc92980c0b/deepfloyd_if/model/nn.py#L54
576
577 def __init__(self, num_heads, embed_dim, dtype=None):
578 super().__init__()
579 self.dtype = dtype
580 self.positional_embedding = nn.Parameter(torch.randn(1, embed_dim) / embed_dim**0.5)
581 self.k_proj = nn.Linear(embed_dim, embed_dim, dtype=self.dtype)
582 self.q_proj = nn.Linear(embed_dim, embed_dim, dtype=self.dtype)
583 self.v_proj = nn.Linear(embed_dim, embed_dim, dtype=self.dtype)
584 self.num_heads = num_heads
585 self.dim_per_head = embed_dim // self.num_heads
586
587 def forward(self, x):
588 bs, length, width = x.size()

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected