def METHOD_NAME():
    img = "test_street_small.jpg"
    img_url = (
        "https://raw.githubusercontent.com/dmlc/web-data/master/gluoncv/detection/street_small.jpg"
    )
    download(img_url, img)
    input_shape = (1, 3, in_size, in_size)
    input_name = "input0"
    shape_list = [(input_name, input_shape)]
    scripted_model = generate_jit_model(1)
    with tvm.testing.disable_span_filling():
        mod, params = relay.frontend.from_pytorch(scripted_model, shape_list)
    with tvm.testing.enable_span_filling():
        mod_with_span, _ = relay.frontend.from_pytorch(scripted_model, shape_list)
    assert tvm.ir.structural_equal(mod, mod_with_span, map_free_vars=True)
    data = process_image(img)
    data_np = data.detach().numpy()
    with torch.no_grad():
        pt_res = scripted_model(data)
    def compile_and_run_vm(mod, params, data_np, target):
        with tvm.transform.PassContext(opt_level=3):
            vm_exec = relay.vm.compile(mod, target=target, params=params)
        dev = tvm.device(target, 0)
        vm = VirtualMachine(vm_exec, dev)
        vm.set_input("main", **{input_name: data_np})
        return vm.run()
    for target in ["llvm"]:
        tvm_res = compile_and_run_vm(mod, params, data_np, target)
        # Bounding boxes
        tvm.testing.assert_allclose(
            pt_res[0].cpu().numpy(), tvm_res[0].numpy(), rtol=1e-5, atol=1e-5
        )
        # Scores
        tvm.testing.assert_allclose(
            pt_res[1].cpu().numpy(), tvm_res[1].numpy(), rtol=1e-5, atol=1e-5
        )
        # Class ids
        np.testing.assert_equal(pt_res[2].cpu().numpy(), tvm_res[2].numpy())
        score_threshold = 0.9
        print("Num boxes:", pt_res[0].cpu().numpy().shape[0])
        print("Num valid boxes:", np.sum(pt_res[1].cpu().numpy() >= score_threshold))
    before = mod["main"]
    mod = rewrite_nms_to_batched_nms(mod)
    after = mod["main"]
    assert not tvm.ir.structural_equal(after, before)
    # TODO(masahi): It seems this rewrite causes flaky segfaults on CI
    # See https://github.com/apache/tvm/issues/7363
    # before = mod["main"]
    # mod = rewrite_batched_nms_with_max_out_size(mod)
    # after = mod["main"]
    # assert not tvm.ir.structural_equal(after, before)
    before = mod["main"]
    mod = rewrite_scatter_to_gather(mod, 4)  # num_scales is 4 for maskrcnn_resnet50_fpn
    after = mod["main"]
    assert not tvm.ir.structural_equal(after, before)
    tvm_res_after_rewrite = compile_and_run_vm(mod, params, data_np, "llvm")
    # Results should be equivalent after rewriting
    for res1, res2 in zip(tvm_res, tvm_res_after_rewrite):
        tvm.testing.assert_allclose(res1.numpy(), res2.numpy())