Skip to content

Commit

Permalink
fix fx tracer to support alpha in RepVGGBlock
Browse files Browse the repository at this point in the history
Signed-off-by: alec.tu <[email protected]>
  • Loading branch information
twmht committed Aug 29, 2023
1 parent 106bec4 commit a2df191
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mmyolo/models/layers/yolo_bricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def __init__(self,
else:
self.se = nn.Identity()

self.use_alpha = use_alpha
if use_alpha:
alpha = torch.ones([
1,
Expand Down Expand Up @@ -246,7 +247,7 @@ def forward(self, inputs: Tensor) -> Tensor:
id_out = 0
else:
id_out = self.rbr_identity(inputs)
if self.alpha:
if self.use_alpha:
return self.nonlinearity(
self.se(
self.rbr_dense(inputs) +
Expand All @@ -265,7 +266,7 @@ def get_equivalent_kernel_bias(self):
kernel3x3, bias3x3 = self._fuse_bn_tensor(self.rbr_dense)
kernel1x1, bias1x1 = self._fuse_bn_tensor(self.rbr_1x1)
kernelid, biasid = self._fuse_bn_tensor(self.rbr_identity)
if self.alpha:
if self.use_alpha:
return kernel3x3 + self.alpha * self._pad_1x1_to_3x3_tensor(
kernel1x1) + kernelid, bias3x3 + self.alpha * bias1x1 + biasid
else:
Expand Down

0 comments on commit a2df191

Please sign in to comment.