Skip to content

Commit 7541776

Browse files
authored
fix isnan_v2 is not supported in paddle2onnx (#14060)
1 parent 4f625dc commit 7541776

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ppocr/modeling/heads/det_db_head.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ def __init__(self, in_channels, kernel_list=[3, 2, 2], **kwargs):
7676
def forward(self, x, return_f=False):
7777
x = self.conv1(x)
7878
x = self.conv_bn1(x)
79-
x = paddle.where(paddle.isnan(x), paddle.zeros_like(x), x)
79+
if self.training:
80+
x = paddle.where(paddle.isnan(x), paddle.zeros_like(x), x)
8081
x = self.conv2(x)
8182
x = self.conv_bn2(x)
82-
x = paddle.where(paddle.isnan(x), paddle.zeros_like(x), x)
83+
if self.training:
84+
x = paddle.where(paddle.isnan(x), paddle.zeros_like(x), x)
8385
if return_f is True:
8486
f = x
8587
x = self.conv3(x)

0 commit comments

Comments
 (0)