Unverified Commit e280f614 authored by F-G Fernandez's avatar F-G Fernandez Committed by GitHub
Browse files

Added __repr__ to MultiScaleRoIAlign (#2840)



* feat: Added __repr__ to MultiScaleRoIAlign

* test: Added unittest for __repr__ of MultiScaleRoIAlign

* feat: Added feature map names in __repr__

* test: Updated unittest
Co-authored-by: default avatarvfdev <vfdev.5@gmail.com>
parent 99bf4c09
......@@ -357,6 +357,20 @@ class PSRoIAlignTester(RoIOpTester, unittest.TestCase):
self._helper_boxes_shape(ops.ps_roi_align)
class MultiScaleRoIAlignTester(unittest.TestCase):
def test_msroialign_repr(self):
fmap_names = ['0']
output_size = (7, 7)
sampling_ratio = 2
# Pass mock feature map names
t = ops.poolers.MultiScaleRoIAlign(fmap_names, output_size, sampling_ratio)
# Check integrity of object __repr__ attribute
expected_string = (f"MultiScaleRoIAlign(featmap_names={fmap_names}, output_size={output_size}, "
f"sampling_ratio={sampling_ratio})")
self.assertEqual(t.__repr__(), expected_string)
class NMSTester(unittest.TestCase):
def reference_nms(self, boxes, scores, iou_threshold):
"""
......
......@@ -258,3 +258,7 @@ class MultiScaleRoIAlign(nn.Module):
result = _onnx_merge_levels(levels, tracing_results)
return result
def __repr__(self) -> str:
return (f"{self.__class__.__name__}(featmap_names={self.featmap_names}, "
f"output_size={self.output_size}, sampling_ratio={self.sampling_ratio})")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment