MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / ResidualBlock

Class ResidualBlock

SRGAN/models.py:45–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44
45class ResidualBlock(torch.nn.Module):
46 def __init__(self,in_channels):
47 super(ResidualBlock, self).__init__()
48 self.block1 = ConvBlock(
49 in_channels,
50 in_channels,
51 kernel_size = (3,3),
52 stride = (1,1),
53 padding = (1,1)
54 )
55 #block2不使用激活函数
56 self.block2 = ConvBlock(
57 in_channels,
58 in_channels,
59 kernel_size = (3,3),
60 stride = (1,1),
61 padding = (1,1),
62 use_act = False
63 )
64 def forward(self,x):
65 out = self.block1(x)
66 out = self.block2(out)
67 return out + x
68
69class Generator(torch.nn.Module):
70 def __init__(self,in_channels = 3, num_channels = 64,num_blocks = 16):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected