From 57e470abe22973a17b0610bd260105e7f6c8da0d Mon Sep 17 00:00:00 2001 From: xiliu8006 <75658786+xiliu8006@users.noreply.github.com> Date: Thu, 1 Jul 2021 10:37:29 +0800 Subject: [PATCH] [Enhance] Confirm the input does not be changed in bg_point_filter unit test (#621) * add unittest to confirm the input is not be modified * assert gt_bboxes_3d * rm .swag * modify np.allclose to np.equal * fix error tap * fix np.equal() error --- .../test_pipelines/test_augmentations/test_transforms_3d.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_data/test_pipelines/test_augmentations/test_transforms_3d.py b/tests/test_data/test_pipelines/test_augmentations/test_transforms_3d.py index 1de4437376..11ca4c4ecc 100644 --- a/tests/test_data/test_pipelines/test_augmentations/test_transforms_3d.py +++ b/tests/test_data/test_pipelines/test_augmentations/test_transforms_3d.py @@ -614,6 +614,7 @@ def test_background_points_filter(): points = np.concatenate([points, extra_points.numpy()], 0) points = LiDARPoints(points, points_dim=4) input_dict = dict(points=points, gt_bboxes_3d=gt_bboxes_3d) + origin_gt_bboxes_3d = gt_bboxes_3d.clone() input_dict = background_points_filter(input_dict) points = input_dict['points'].tensor.numpy() @@ -622,7 +623,9 @@ def test_background_points_filter(): '[[0.5, 2.0, 0.5]])' assert repr_str == expected_repr_str assert points.shape == (800, 4) - assert np.allclose(orig_points, points) + assert np.equal(orig_points, points).all() + assert np.equal(input_dict['gt_bboxes_3d'].tensor.numpy(), + origin_gt_bboxes_3d.tensor.numpy()).all() # test single float config BackgroundPointsFilter(0.5)