Skip to content

Commit b15da9a

Browse files
authored
Compare Optional[Tensor] by using is None to avoid introduce control flow in Dy2St (#9254)
1 parent 1f3ce3a commit b15da9a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ppdet/modeling/backbones/cspresnet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def forward(self, x):
8888
if hasattr(self, 'conv'):
8989
y = self.conv(x)
9090
else:
91-
if self.alpha:
91+
if self.alpha is not None:
9292
y = self.conv1(x) + self.alpha * self.conv2(x)
9393
else:
9494
y = self.conv1(x) + self.conv2(x)
@@ -113,7 +113,7 @@ def convert_to_deploy(self):
113113
def get_equivalent_kernel_bias(self):
114114
kernel3x3, bias3x3 = self._fuse_bn_tensor(self.conv1)
115115
kernel1x1, bias1x1 = self._fuse_bn_tensor(self.conv2)
116-
if self.alpha:
116+
if self.alpha is not None:
117117
return kernel3x3 + self.alpha * self._pad_1x1_to_3x3_tensor(
118118
kernel1x1), bias3x3 + self.alpha * bias1x1
119119
else:

0 commit comments

Comments
 (0)