From 6cd51ce3ae9c4d6cf3d40b287b5a992846f54333 Mon Sep 17 00:00:00 2001 From: quotentiroler Date: Thu, 15 Oct 2026 16:06:47 +0200 Subject: [PATCH] [tests] Compare eager and compiled seg maps in detection compile test test_torch_compiled_models unpacked the compiled predictor's maps into seg_maps, which overwrote the eager maps, so the seg map assertion zipped seg_maps with itself and could never fail. Keep the compiled maps in their own variable and compare them against the eager ones at the existing atol=1e-4. --- tests/pytorch/test_models_detection_pt.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/pytorch/test_models_detection_pt.py b/tests/pytorch/test_models_detection_pt.py index 34a97dcc96..e1ad77fd3b 100644 --- a/tests/pytorch/test_models_detection_pt.py +++ b/tests/pytorch/test_models_detection_pt.py @@ -214,7 +214,7 @@ def test_torch_compiled_models(arch_name, mock_payslip): compiled_model = torch.compile(detection.__dict__[arch_name](pretrained=True).eval()) assert isinstance(compiled_model, _CompiledModule) compiled_predictor = detection.zoo.detection_predictor(compiled_model) - compiled_out, seg_maps = compiled_predictor(doc, return_maps=True) + compiled_out, compiled_seg_maps = compiled_predictor(doc, return_maps=True) # Compare assert all( @@ -222,7 +222,8 @@ def test_torch_compiled_models(arch_name, mock_payslip): for out_boxes, compiled_out_boxes in zip(out, compiled_out) ) assert all( - np.allclose(seg_map, compiled_seg_map, atol=1e-4) for seg_map, compiled_seg_map in zip(seg_maps, seg_maps) + np.allclose(seg_map, compiled_seg_map, atol=1e-4) + for seg_map, compiled_seg_map in zip(seg_maps, compiled_seg_maps) )