MCPcopy Create free account
hub / github.com/cxzhou95/XLSR / __init__

Method __init__

model.py:115–141  ·  view source on GitHub ↗
(self, SR_rate)

Source from the content-addressed store, hash-verified

113
114class XLSR_quantization(nn.Module):
115 def __init__(self, SR_rate):
116 super(XLSR_quantization, self).__init__()
117 self.quant = QuantStub()
118 self.dequant = DeQuantStub()
119
120 self.conv0_0 = ConvRelu(in_channels=3, out_channels=8, kernel_size=3)
121 self.conv0_1 = ConvRelu(in_channels=3, out_channels=8, kernel_size=3)
122 self.conv0_2 = ConvRelu(in_channels=3, out_channels=8, kernel_size=3)
123 self.conv0_3 = ConvRelu(in_channels=3, out_channels=8, kernel_size=3)
124
125 self.conv1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, padding=1)
126 self.conv2 = nn.Conv2d(in_channels=32, out_channels=32, kernel_size=1, padding=0)
127 self.conv3 = ConvRelu(in_channels=48, out_channels=32, kernel_size=1)
128 self.conv4 = nn.Conv2d(in_channels=32, out_channels=3 * SR_rate ** 2, kernel_size=3, padding=1)
129
130 self.Gblocks = nn.Sequential(Gblock(32, 32, 4), Gblock(32, 32, 4), Gblock(32, 32, 4))
131 self.depth2spcae = nn.PixelShuffle(SR_rate)
132 self.clippedReLU = ClippedReLU()
133 self.cat1 = nn.quantized.FloatFunctional()
134 self.cat2 = nn.quantized.FloatFunctional()
135
136 # init weights
137 for m in self.modules():
138 if isinstance(m, nn.Conv2d):
139 nn.init.kaiming_normal_(m.weight.data, mode='fan_out', nonlinearity='relu')
140 if m.bias is not None:
141 nn.init.constant_(m.bias.data, 0.01)
142
143 def forward(self, x):
144

Callers

nothing calls this directly

Calls 4

ConvReluClass · 0.85
GblockClass · 0.85
ClippedReLUClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected