@@ -1489,32 +1489,6 @@ def test_empty_distance_iou_inputs(self, dtype, device):
14891489 assert_empty_loss (ops .distance_box_iou_loss , dtype , device )
14901490
14911491
1492- class TestLastLevelMaxPool2d :
1493- def _generate_fpn_feature_maps (self , ** kwargs ) -> Tuple [List [Tensor ], List [str ]]:
1494- feature_maps = [
1495- torch .rand (16 , 3 , 240 , 320 ),
1496- torch .rand (16 , 3 , 120 , 160 ),
1497- torch .rand (16 , 3 , 60 , 80 ),
1498- torch .rand (16 , 3 , 30 , 40 ),
1499- ]
1500- names = ["0" , "1" , "2" , "3" ]
1501-
1502- return feature_maps , names
1503-
1504- def test_lastlevel_maxpool2d (self ) -> None :
1505- feature_maps , names = self ._generate_fpn_feature_maps ()
1506- extra_blocks = ops .feature_pyramid_network .LastLevelMaxPool ()
1507-
1508- # skip what FPN really dit, simply copy results from feature maps here.
1509- results = feature_maps
1510-
1511- expected_pooled_featuremap = F .max_pool2d (feature_maps [- 1 ], 2 , 2 , 0 )
1512- results , names = extra_blocks (results , feature_maps , names )
1513-
1514- tol = 1e-3 if feature_maps [- 1 ].dtype is torch .half else 1e-5
1515- torch .testing .assert_close (expected_pooled_featuremap , results [- 1 ], atol = tol , rtol = tol )
1516-
1517-
15181492class TestFocalLoss :
15191493 def _generate_diverse_input_target_pair (self , shape = (5 , 2 ), ** kwargs ):
15201494 def logit (p ):
0 commit comments