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

Function test_network

tests/python/nightly/test_nnapi/test_network.py:120–134  ·  view source on GitHub ↗
(name, dtype)

Source from the content-addressed store, hash-verified

118)
119@pytest.mark.skipif(not env.has_nnapi(), reason="need nnapi")
120def test_network(name, dtype):
121 remote_obj, tracker = remote()
122 print(f"Network evaluating {name} with dtype {dtype}")
123 np.random.seed(0)
124 mod, inputs = get_network(name, dtype)
125 input_data = {}
126
127 for _name, (shape, _dtype) in inputs.items():
128 input_data[_name] = np.random.uniform(-1.0, 1.0, shape).astype(_dtype)
129
130 inputs_tvm: list[tvm.runtime.Tensor] = [tvm.runtime.tensor(v) for k, v in input_data.items()]
131 outputs = _build_and_run_network(remote_obj, tracker, mod, inputs_tvm)
132 nnapi_out = outputs[0]
133 expected_out = outputs[1]
134 tvm.testing.assert_allclose(nnapi_out, expected_out, rtol=1e-4, atol=1e-5)
135
136
137if __name__ == "__main__":

Callers

nothing calls this directly

Calls 8

remoteFunction · 0.90
printFunction · 0.85
get_networkFunction · 0.85
seedMethod · 0.80
uniformMethod · 0.80
_build_and_run_networkFunction · 0.70
itemsMethod · 0.45
astypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…