Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【PIR API adaptor No.149】matrix_nms #58937

Merged
merged 6 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/paddle/vision/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from ..base import core
from ..base.data_feeder import check_type, check_variable_and_dtype
from ..base.framework import Variable, in_dygraph_mode
from ..base.framework import Variable, in_dygraph_mode, in_dynamic_or_pir_mode
from ..base.layer_helper import LayerHelper
from ..framework import _current_expected_place
from ..nn import BatchNorm2D, Conv2D, Layer, ReLU, Sequential
Expand Down Expand Up @@ -2284,7 +2284,7 @@ def matrix_nms(
... score_threshold=0.5, post_threshold=0.1,
... nms_top_k=400, keep_top_k=200, normalized=False)
"""
if in_dygraph_mode():
if in_dynamic_or_pir_mode():
out, index, rois_num = _C_ops.matrix_nms(
bboxes,
scores,
Expand Down
7 changes: 4 additions & 3 deletions test/legacy_test/test_matrix_nms_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from op_test import OpTest

import paddle
from paddle.base import Program, program_guard


def python_matrix_nms(
Expand Down Expand Up @@ -296,7 +295,7 @@ def setUp(self):
}

def test_check_output(self):
self.check_output()
self.check_output(check_pir=True)


class TestMatrixNMSOpNoOutput(TestMatrixNMSOp):
Expand Down Expand Up @@ -327,7 +326,9 @@ def test_errors(self):
scores = np.reshape(scores, (N, M, C))
scores_np = np.transpose(scores, (0, 2, 1))

with program_guard(Program(), Program()):
with paddle.static.program_guard(
paddle.static.Program(), paddle.static.Program()
):
boxes_data = paddle.static.data(
name='bboxes', shape=[M, C, BOX_SIZE], dtype='float32'
)
Expand Down