Skip to content

Commit

Permalink
test roi_align_rotated
Browse files Browse the repository at this point in the history
  • Loading branch information
hub-bla committed Jul 26, 2024
1 parent fbc6f8e commit 3496513
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/bindings/python/tests/test_graph/test_create_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import openvino.runtime.opset1 as ov_opset1
import openvino.runtime.opset5 as ov_opset5
import openvino.runtime.opset10 as ov_opset10
import openvino.runtime.opset15 as ov_opset15
import openvino.runtime.opset11 as ov
from openvino.runtime.op.util import VariableInfo, Variable

Expand Down Expand Up @@ -885,6 +886,37 @@ def test_roi_align(data_shape, rois, batch_indices, pooled_h, pooled_w, sampling
assert list(node.get_output_shape(0)) == expected_shape


@pytest.mark.parametrize(
("data_shape", "rois", "batch_indices", "pooled_h", "pooled_w", "sampling_ratio", "spatial_scale", "clockwise_mode", "expected_shape"),
[
([2, 3, 5, 6], [7, 5], [7], 2, 2, 1, 1.0, True, [7, 3, 2, 2]),
([10, 3, 5, 5], [7, 5], [7], 3, 4, 1, 1.0, True, [7, 3, 3, 4]),
([10, 3, 5, 5], [3, 5], [3], 3, 4, 1, 1.0, False, [3, 3, 3, 4]),
([10, 3, 5, 5], [3, 5], [3], 3, 4, 1, float(1), False, [3, 3, 3, 4]),
],
)
def test_roi_align_rotated(data_shape, rois, batch_indices, pooled_h, pooled_w, sampling_ratio, spatial_scale, clockwise_mode, expected_shape):
data_parameter = ov.parameter(data_shape, name="Data", dtype=np.float32)
rois_parameter = ov.parameter(rois, name="Rois", dtype=np.float32)
batch_indices_parameter = ov.parameter(batch_indices, name="Batch_indices", dtype=np.int32)

node = ov_opset15.roi_align_rotated(
data_parameter,
rois_parameter,
batch_indices_parameter,
pooled_h,
pooled_w,
sampling_ratio,
spatial_scale,
clockwise_mode,
)

assert node.get_type_name() == "ROIAlignRotated"
assert node.get_output_size() == 1
assert node.get_output_element_type(0) == Type.f32
assert list(node.get_output_shape(0)) == expected_shape


@pytest.mark.parametrize("op_name", ["psroipooling", "psroiPoolingOpset1"])
def test_psroi_pooling(op_name):
inputs = ov.parameter([1, 72, 4, 5], dtype=np.float32)
Expand Down

0 comments on commit 3496513

Please sign in to comment.