(self, x)
| 41 | self.attention = QKVAttention(self.num_heads) |
| 42 | |
| 43 | def forward(self, x): |
| 44 | b, c, *_spatial = x.shape |
| 45 | x = x.reshape(b, c, -1) # NC(HW) |
| 46 | x = th.cat([x.mean(dim=-1, keepdim=True), x], dim=-1) # NC(HW+1) |
| 47 | x = x + self.positional_embedding[None, :, :].to(x.dtype) # NC(HW+1) |
| 48 | x = self.qkv_proj(x) |
| 49 | x = self.attention(x) |
| 50 | x = self.c_proj(x) |
| 51 | return x[:, :, 0] |
| 52 | |
| 53 | |
| 54 | class TimestepBlock(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected