(self, x, temb)
| 134 | padding=0) |
| 135 | |
| 136 | def forward(self, x, temb): |
| 137 | h = x |
| 138 | h = self.norm1(h) |
| 139 | h = nonlinearity(h) |
| 140 | h = self.conv1(h) |
| 141 | |
| 142 | if temb is not None: |
| 143 | h = h + self.temb_proj(nonlinearity(temb))[:,:,None,None] |
| 144 | |
| 145 | h = self.norm2(h) |
| 146 | h = nonlinearity(h) |
| 147 | h = self.dropout(h) |
| 148 | h = self.conv2(h) |
| 149 | |
| 150 | if self.in_channels != self.out_channels: |
| 151 | if self.use_conv_shortcut: |
| 152 | x = self.conv_shortcut(x) |
| 153 | else: |
| 154 | x = self.nin_shortcut(x) |
| 155 | |
| 156 | return x+h |
| 157 | |
| 158 | |
| 159 | class AttnBlock(nn.Module): |
nothing calls this directly
no test coverage detected