From 843a95a35ebee066fec3cbd831ec8776929510f2 Mon Sep 17 00:00:00 2001 From: Channingss Date: Tue, 1 Sep 2020 08:22:53 +0000 Subject: [PATCH] fix bug of multiclass_nms when attr:keep_top_k==-1 --- .../paddle2onnx/opset11/paddle_custom_layer/multiclass_nms.py | 2 +- .../paddle2onnx/opset9/paddle_custom_layer/multiclass_nms.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x2paddle/op_mapper/paddle2onnx/opset11/paddle_custom_layer/multiclass_nms.py b/x2paddle/op_mapper/paddle2onnx/opset11/paddle_custom_layer/multiclass_nms.py index 7060cfb..f953ad9 100644 --- a/x2paddle/op_mapper/paddle2onnx/opset11/paddle_custom_layer/multiclass_nms.py +++ b/x2paddle/op_mapper/paddle2onnx/opset11/paddle_custom_layer/multiclass_nms.py @@ -72,7 +72,7 @@ def multiclass_nms(op, block): dims=(), vals=[float(attrs['nms_threshold'])])) - boxes_num = block.var( outputs['Out'][0]).shape[0] + boxes_num = block.var(outputs['Out'][0]).shape[0] top_k_value = np.int64(boxes_num if attrs['keep_top_k'] == -1 else attrs['keep_top_k']) node_keep_top_k = onnx.helper.make_node( 'Constant', diff --git a/x2paddle/op_mapper/paddle2onnx/opset9/paddle_custom_layer/multiclass_nms.py b/x2paddle/op_mapper/paddle2onnx/opset9/paddle_custom_layer/multiclass_nms.py index 57d8a74..6d8172f 100644 --- a/x2paddle/op_mapper/paddle2onnx/opset9/paddle_custom_layer/multiclass_nms.py +++ b/x2paddle/op_mapper/paddle2onnx/opset9/paddle_custom_layer/multiclass_nms.py @@ -72,7 +72,7 @@ def multiclass_nms(op, block): dims=(), vals=[float(attrs['nms_threshold'])])) - boxes_num = block.var( outputs['Out'][0]).shape[0] + boxes_num = block.var(outputs['Out'][0]).shape[0] top_k_value = np.int64(boxes_num if attrs['keep_top_k'] == -1 else attrs['keep_top_k']) node_keep_top_k = onnx.helper.make_node( 'Constant', -- GitLab