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