MCPcopy Create free account
hub / github.com/apache/tvm / verify_model

Function verify_model

tests/python/relax/test_frontend_from_exported_program.py:37–62  ·  view source on GitHub ↗
(
    torch_model,
    example_args,
    binding,
    expected,
    dynamic_shapes=None,
    run_ep_decomposition=True,
    keep_params_as_input=False,
    unwrap_unit_return_tuple=False,
    no_bind_return_tuple=False,
    map_free_vars=False,
    custom_convert_map=None,
)

Source from the content-addressed store, hash-verified

35
36
37def verify_model(
38 torch_model,
39 example_args,
40 binding,
41 expected,
42 dynamic_shapes=None,
43 run_ep_decomposition=True,
44 keep_params_as_input=False,
45 unwrap_unit_return_tuple=False,
46 no_bind_return_tuple=False,
47 map_free_vars=False,
48 custom_convert_map=None,
49):
50 exported_program = export(torch_model, args=example_args, dynamic_shapes=dynamic_shapes)
51 mod = from_exported_program(
52 exported_program,
53 run_ep_decomposition=run_ep_decomposition,
54 keep_params_as_input=keep_params_as_input,
55 unwrap_unit_return_tuple=unwrap_unit_return_tuple,
56 no_bind_return_tuple=no_bind_return_tuple,
57 custom_convert_map=custom_convert_map,
58 )
59
60 binding = {k: tvm.runtime.tensor(v) for k, v in binding.items()}
61 expected = relax.transform.BindParams("main", binding)(expected)
62 tvm.ir.assert_structural_equal(mod, expected, map_free_vars=map_free_vars)
63
64
65def verify_model_numerically(torch_model, example_args, rtol=1e-7, atol=1e-7):

Callers 15

test_basic_unary_opsFunction · 0.70
test_bool_unary_opsFunction · 0.70
test_sqrt_integer_inputFunction · 0.70
test_extended_unary_opsFunction · 0.70
test_hardtanhFunction · 0.70
test_softplusFunction · 0.70
test_leakyreluFunction · 0.70
test_logaddexpFunction · 0.70
test_logical_andFunction · 0.70
test_logical_notFunction · 0.70
test_logical_orFunction · 0.70
test_logical_xorFunction · 0.70

Calls 2

from_exported_programFunction · 0.90
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…