def test_aggregate_results():
    fake_heatmaps = [torch.zeros((1, 2, 2, 2))]
    fake_tags = [torch.zeros((1, 2, 2, 2))]
    (aggregated_heatmaps, tags_list) = aggregate_results(scale=1, aggregated_heatmaps=None, tags_list=[], heatmaps=fake_heatmaps, tags=fake_tags, test_scale_factor=[1], project2image=True, flip_test=False)
    assert torch.allclose(aggregated_heatmaps, torch.tensor(0.0))
    fake_aggr_heatmaps = torch.ones(1, 2, 2, 2)
    (aggregated_heatmaps, tags_list) = aggregate_results(scale=1, aggregated_heatmaps=fake_aggr_heatmaps, tags_list=[], heatmaps=fake_heatmaps, tags=fake_tags, test_scale_factor=[1], project2image=True, flip_test=False)
    assert torch.allclose(aggregated_heatmaps, torch.tensor(1.0))
    (aggregated_heatmaps, tags_list) = aggregate_results(scale=1, aggregated_heatmaps=fake_aggr_heatmaps, tags_list=[], heatmaps=fake_heatmaps, tags=fake_tags, test_scale_factor=[1], project2image=True, flip_test=False, align_corners=True)
    assert torch.allclose(aggregated_heatmaps, torch.tensor(1.0))
    fake_heatmaps = [torch.zeros((1, 2, 2, 2)), torch.ones((1, 2, 2, 2))]
    fake_aggr_heatmaps = torch.ones(1, 2, 4, 4)
    (aggregated_heatmaps, tags_list) = aggregate_results(scale=1, aggregated_heatmaps=fake_aggr_heatmaps, tags_list=[], heatmaps=fake_heatmaps, tags=fake_tags, test_scale_factor=[1], project2image=False, flip_test=True)
    assert (aggregated_heatmaps.shape == torch.Size((1, 2, 4, 4)))
    (aggregated_heatmaps, tags_list) = aggregate_results(scale=2, aggregated_heatmaps=fake_aggr_heatmaps, tags_list=[], heatmaps=fake_heatmaps, tags=fake_tags, test_scale_factor=[1, 2], project2image=False, flip_test=True)
    assert (aggregated_heatmaps.shape == torch.Size((1, 2, 4, 4)))
def test_aggregate_results():
    fake_heatmaps = [torch.zeros((1, 2, 2, 2))]
    fake_tags = [torch.zeros((1, 2, 2, 2))]
    (aggregated_heatmaps, tags_list) = aggregate_results(scale=1, aggregated_heatmaps=None, tags_list=[], heatmaps=fake_heatmaps, tags=fake_tags, test_scale_factor=[1], project2image=True, flip_test=False)
    assert torch.allclose(aggregated_heatmaps, torch.tensor(0.0))
    fake_aggr_heatmaps = torch.ones(1, 2, 2, 2)
    (aggregated_heatmaps, tags_list) = aggregate_results(scale=1, aggregated_heatmaps=fake_aggr_heatmaps, tags_list=[], heatmaps=fake_heatmaps, tags=fake_tags, test_scale_factor=[1], project2image=True, flip_test=False)
    assert torch.allclose(aggregated_heatmaps, torch.tensor(1.0))
    (aggregated_heatmaps, tags_list) = aggregate_results(scale=1, aggregated_heatmaps=fake_aggr_heatmaps, tags_list=[], heatmaps=fake_heatmaps, tags=fake_tags, test_scale_factor=[1], project2image=True, flip_test=False, align_corners=True)
    assert torch.allclose(aggregated_heatmaps, torch.tensor(1.0))
    fake_heatmaps = [torch.zeros((1, 2, 2, 2)), torch.ones((1, 2, 2, 2))]
    fake_aggr_heatmaps = torch.ones(1, 2, 4, 4)
    (aggregated_heatmaps, tags_list) = aggregate_results(scale=1, aggregated_heatmaps=fake_aggr_heatmaps, tags_list=[], heatmaps=fake_heatmaps, tags=fake_tags, test_scale_factor=[1], project2image=False, flip_test=True)
    assert (aggregated_heatmaps.shape == torch.Size((1, 2, 4, 4)))
    (aggregated_heatmaps, tags_list) = aggregate_results(scale=2, aggregated_heatmaps=fake_aggr_heatmaps, tags_list=[], heatmaps=fake_heatmaps, tags=fake_tags, test_scale_factor=[1, 2], project2image=False, flip_test=True)
    assert (aggregated_heatmaps.shape == torch.Size((1, 2, 4, 4)))