Skip to content
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
6 changes: 3 additions & 3 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 @@ -1547,7 +1547,7 @@ def roi_pool(x, boxes, boxes_num, output_size, spatial_scale=1.0, name=None):
output_size = (output_size, output_size)

pooled_height, pooled_width = output_size
if in_dygraph_mode():
if in_dynamic_or_pir_mode():
assert (
boxes_num is not None
), "boxes_num should not be None in dygraph mode."
Expand Down Expand Up @@ -1707,7 +1707,7 @@ def roi_align(
output_size = (output_size, output_size)

pooled_height, pooled_width = output_size
if in_dygraph_mode():
if in_dynamic_or_pir_mode():
assert (
boxes_num is not None
), "boxes_num should not be None in dygraph mode."
Expand Down
3 changes: 3 additions & 0 deletions test/legacy_test/test_ops_roi_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import numpy as np

import paddle
from paddle.pir_utils import test_with_pir_api
from paddle.vision.ops import RoIAlign, roi_align


Expand Down Expand Up @@ -81,11 +82,13 @@ def test_roi_align_functional_dynamic(self):
self.roi_align_functional(3)
self.roi_align_functional(output_size=(3, 4))

@test_with_pir_api
def test_roi_align_functional_static(self):
paddle.enable_static()
self.roi_align_functional(3)
paddle.disable_static()

@test_with_pir_api
def test_RoIAlign(self):
roi_align_c = RoIAlign(output_size=(4, 3))
data = paddle.to_tensor(self.data)
Expand Down
2 changes: 2 additions & 0 deletions test/legacy_test/test_ops_roi_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import numpy as np

import paddle
from paddle.pir_utils import test_with_pir_api
from paddle.vision.ops import RoIPool, roi_pool


Expand Down Expand Up @@ -81,6 +82,7 @@ def test_roi_pool_functional_dynamic(self):
self.roi_pool_functional(3)
self.roi_pool_functional(output_size=(3, 4))

@test_with_pir_api
def test_roi_pool_functional_static(self):
paddle.enable_static()
self.roi_pool_functional(3)
Expand Down