(name, dtype)
| 118 | ) |
| 119 | @pytest.mark.skipif(not env.has_nnapi(), reason="need nnapi") |
| 120 | def 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 | |
| 137 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected
searching dependent graphs…