MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / forward

Method forward

ldm/modules/diffusionmodules/openaimodel.py:53–61  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

51 self.attention = QKVAttention(self.num_heads)
52
53 def forward(self, x):
54 b, c, *_spatial = x.shape
55 x = x.reshape(b, c, -1) # NC(HW)
56 x = th.cat([x.mean(dim=-1, keepdim=True), x], dim=-1) # NC(HW+1)
57 x = x + self.positional_embedding[None, :, :].to(x.dtype) # NC(HW+1)
58 x = self.qkv_proj(x)
59 x = self.attention(x)
60 x = self.c_proj(x)
61 return x[:, :, 0]
62
63
64class TimestepBlock(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected