ONE - On-device Neural Engine
|
Functions | |
extract_test_args (s) | |
Managing paths for the artifacts required by the test. | |
check_for_errors () | |
error_checked (func) | |
Variables | |
parser = argparse.ArgumentParser() | |
type | |
str | |
required | |
args = parser.parse_args() | |
list | contents = [line.rstrip() for line in f] |
list | eval_lines = [line for line in contents if line.startswith('eval(')] |
list | test_args = [extract_test_args(line) for line in eval_lines] |
list | test_models = [Path(args.artifact_dir) / f'{arg}.circle' for arg in test_args] |
list | input_data |
list | expected_output_data |
ffi = FFI() | |
C = ffi.dlopen(args.lib_path) | |
Interpreter_new = error_checked(C.Interpreter_new) | |
Interpreter_delete = error_checked(C.Interpreter_delete) | |
Interpreter_interpret = error_checked(C.Interpreter_interpret) | |
Interpreter_writeInputTensor = error_checked(C.Interpreter_writeInputTensor) | |
Interpreter_readOutputTensor = error_checked(C.Interpreter_readOutputTensor) | |
model_data = ffi.from_buffer(bytearray(f.read())) | |
intp = Interpreter_new(model_data, len(model_data)) | |
h5 = h5py.File(input_data[idx]) | |
input_values = h5.get('value') | |
input_num = len(input_values) | |
arr = np.array(input_values.get(str(input_idx))) | |
c_arr = ffi.from_buffer(arr) | |
output_values = h5.get('value') | |
output_num = len(output_values) | |
result = np.empty(arr.shape, dtype=arr.dtype) | |
infer.check_for_errors | ( | ) |
Definition at line 55 of file infer.py.
Referenced by error_checked().
infer.error_checked | ( | func | ) |
Decorator to wrap functions with error checking.
Definition at line 62 of file infer.py.
References check_for_errors().
infer.extract_test_args | ( | s | ) |
list infer.eval_lines = [line for line in contents if line.startswith('eval(')] |
list infer.expected_output_data |
infer.h5 = h5py.File(input_data[idx]) |
list infer.input_data |
infer.input_num = len(input_values) |
infer.Interpreter_delete = error_checked(C.Interpreter_delete) |
infer.Interpreter_interpret = error_checked(C.Interpreter_interpret) |
infer.Interpreter_new = error_checked(C.Interpreter_new) |
infer.Interpreter_readOutputTensor = error_checked(C.Interpreter_readOutputTensor) |
infer.Interpreter_writeInputTensor = error_checked(C.Interpreter_writeInputTensor) |
infer.intp = Interpreter_new(model_data, len(model_data)) |
infer.output_num = len(output_values) |
list infer.test_args = [extract_test_args(line) for line in eval_lines] |
list infer.test_models = [Path(args.artifact_dir) / f'{arg}.circle' for arg in test_args] |