(self, x)
| 112 | self.attention = QKVAttention(self.num_heads) |
| 113 | |
| 114 | def forward(self, x): |
| 115 | b, c, *_spatial = x.shape |
| 116 | x = x.reshape(b, c, -1) # NC(HW) |
| 117 | x = th.cat([x.mean(dim=-1, keepdim=True), x], dim=-1) # NC(HW+1) |
| 118 | x = x + self.positional_embedding[None, :, :].to(x.dtype) # NC(HW+1) |
| 119 | x = self.qkv_proj(x) |
| 120 | x = self.attention(x) |
| 121 | x = self.c_proj(x) |
| 122 | return x[:, :, 0] |
| 123 | |
| 124 | |
| 125 | class TimestepBlock(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected