Skip to content

Commit ae4012e

Browse files
authored
fix inception (#1954)
1 parent de140c1 commit ae4012e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

torchvision/models/quantization/inception.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,24 @@ def forward(self, x):
138138
class QuantizableInceptionE(inception_module.InceptionE):
139139
def __init__(self, *args, **kwargs):
140140
super(QuantizableInceptionE, self).__init__(conv_block=QuantizableBasicConv2d, *args, **kwargs)
141-
self.myop = nn.quantized.FloatFunctional()
141+
self.myop1 = nn.quantized.FloatFunctional()
142+
self.myop2 = nn.quantized.FloatFunctional()
143+
self.myop3 = nn.quantized.FloatFunctional()
142144

143145
def _forward(self, x):
144146
branch1x1 = self.branch1x1(x)
145147

146148
branch3x3 = self.branch3x3_1(x)
147149
branch3x3 = [self.branch3x3_2a(branch3x3), self.branch3x3_2b(branch3x3)]
148-
branch3x3 = self.myop.cat(branch3x3, 1)
150+
branch3x3 = self.myop1.cat(branch3x3, 1)
149151

150152
branch3x3dbl = self.branch3x3dbl_1(x)
151153
branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl)
152154
branch3x3dbl = [
153155
self.branch3x3dbl_3a(branch3x3dbl),
154156
self.branch3x3dbl_3b(branch3x3dbl),
155157
]
156-
branch3x3dbl = self.myop.cat(branch3x3dbl, 1)
158+
branch3x3dbl = self.myop2.cat(branch3x3dbl, 1)
157159

158160
branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1)
159161
branch_pool = self.branch_pool(branch_pool)
@@ -163,7 +165,7 @@ def _forward(self, x):
163165

164166
def forward(self, x):
165167
outputs = self._forward(x)
166-
return self.myop.cat(outputs, 1)
168+
return self.myop3.cat(outputs, 1)
167169

168170

169171
class QuantizableInceptionAux(inception_module.InceptionAux):

0 commit comments

Comments
 (0)