(self, dim, dilation=1)
| 473 | |
| 474 | class ResnetBlock(nn.Module): |
| 475 | def __init__(self, dim, dilation=1): |
| 476 | super(ResnetBlock, self).__init__() |
| 477 | self.conv_block = nn.Sequential( |
| 478 | nn.ReflectionPad2d(dilation), |
| 479 | spectral_norm(nn.Conv2d(in_channels=dim, out_channels=dim, kernel_size=3, padding=0, dilation=dilation, bias=not True), True), |
| 480 | nn.InstanceNorm2d(dim, track_running_stats=False), |
| 481 | nn.LeakyReLU(negative_slope=0.2), |
| 482 | |
| 483 | nn.ReflectionPad2d(1), |
| 484 | spectral_norm(nn.Conv2d(in_channels=dim, out_channels=dim, kernel_size=3, padding=0, dilation=1, bias=not True), True), |
| 485 | nn.InstanceNorm2d(dim, track_running_stats=False), |
| 486 | ) |
| 487 | |
| 488 | def forward(self, x): |
| 489 | out = x + self.conv_block(x) |
nothing calls this directly
no test coverage detected