(self, x, temb)
| 113 | padding=0) |
| 114 | |
| 115 | def forward(self, x, temb): |
| 116 | h = x |
| 117 | h = self.norm1(h) |
| 118 | h = nonlinearity(h) |
| 119 | h = self.conv1(h) |
| 120 | |
| 121 | h = h + self.temb_proj(nonlinearity(temb))[:, :, None, None] |
| 122 | |
| 123 | h = self.norm2(h) |
| 124 | h = nonlinearity(h) |
| 125 | h = self.dropout(h) |
| 126 | h = self.conv2(h) |
| 127 | |
| 128 | if self.in_channels != self.out_channels: |
| 129 | if self.use_conv_shortcut: |
| 130 | x = self.conv_shortcut(x) |
| 131 | else: |
| 132 | x = self.nin_shortcut(x) |
| 133 | |
| 134 | return x+h |
| 135 | |
| 136 | |
| 137 | class AttnBlock(nn.Module): |
nothing calls this directly
no test coverage detected