ONE - On-device Neural Engine
|
Functions | |
chunks (lst, n) | |
toNumpyType (circle_type) | |
Variables | |
parser = argparse.ArgumentParser() | |
type | |
required | |
help | |
nargs | |
action | |
str | |
default | |
args = parser.parse_args() | |
output_dir = args.output_dir | |
artifact_dir = args.artifact_dir | |
input_dir = args.input_dir | |
test_param = args.test_param | |
config = args.config | |
mode = args.mode | |
dict | modes_to_input_h5_suffix |
test_params = test_param[0].split() | |
int | PARAM_SET_SIZE = 3 |
model_name = test_params[idx][0] | |
granularity = test_params[idx][1] | |
dtype = test_params[idx][2] | |
model = os.path.join(artifact_dir, model_name + '.circle') | |
buf = f.read() | |
circle_model = Model.GetRootAsModel(buf, 0) | |
graph = circle_model.Subgraphs(0) | |
inputs = graph.InputsAsNumpy() | |
str | testcase = f'{model_name}.{granularity}.{dtype}' |
output = os.path.join(output_dir, f'{testcase}.{modes_to_input_h5_suffix[mode]}') | |
h5_file = h5.File(output, 'w') | |
group = h5_file.create_group("value") | |
input_text_dir | |
records = sorted(glob.glob(input_text_dir + "/*.txt")) | |
sample = group.create_group(str(i)) | |
lines = f.readlines() | |
data = np.array(line.split(',')) | |
input_index = inputs[j] | |
tensor = graph.Tensors(input_index) | |
np_type = toNumpyType(tensor.Type()) | |
input_data = np.array(data.reshape(tensor.ShapeAsNumpy()), np_type) | |
gen_h5_explicit_inputs_all.chunks | ( | lst, | |
n | |||
) |
Yield successive n-sized chunks from the list
Definition at line 11 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.toNumpyType | ( | circle_type | ) |
Definition at line 17 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.action |
Definition at line 60 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.args = parser.parse_args() |
Definition at line 62 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.artifact_dir = args.artifact_dir |
Definition at line 65 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.buf = f.read() |
Definition at line 87 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.circle_model = Model.GetRootAsModel(buf, 0) |
Definition at line 88 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.config = args.config |
Definition at line 68 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.data = np.array(line.split(',')) |
Definition at line 116 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.default |
Definition at line 61 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.dtype | ( | void | ) | = test_params[idx][2] |
Definition at line 83 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.granularity = test_params[idx][1] |
Definition at line 82 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.graph = circle_model.Subgraphs(0) |
Definition at line 92 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.group = h5_file.create_group("value") |
Definition at line 100 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.h5_file = h5.File(output, 'w') |
Definition at line 99 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.help |
Definition at line 43 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.input_data = np.array(data.reshape(tensor.ShapeAsNumpy()), np_type) |
Definition at line 120 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.input_dir = args.input_dir |
Definition at line 66 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.input_index = inputs[j] |
Definition at line 117 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.input_text_dir |
Definition at line 104 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.inputs = graph.InputsAsNumpy() |
Definition at line 93 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.lines = f.readlines() |
Definition at line 114 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.mode = args.mode |
Definition at line 69 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.model = os.path.join(artifact_dir, model_name + '.circle') |
Definition at line 85 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.model_name = test_params[idx][0] |
Definition at line 81 of file gen_h5_explicit_inputs_all.py.
dict gen_h5_explicit_inputs_all.modes_to_input_h5_suffix |
Definition at line 71 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.nargs |
Definition at line 56 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.np_type = toNumpyType(tensor.Type()) |
Definition at line 119 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.output = os.path.join(output_dir, f'{testcase}.{modes_to_input_h5_suffix[mode]}') |
Definition at line 96 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.output_dir = args.output_dir |
Definition at line 64 of file gen_h5_explicit_inputs_all.py.
int gen_h5_explicit_inputs_all.PARAM_SET_SIZE = 3 |
Definition at line 77 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.parser = argparse.ArgumentParser() |
Definition at line 39 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.records = sorted(glob.glob(input_text_dir + "/*.txt")) |
Definition at line 109 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.required |
Definition at line 42 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.sample = group.create_group(str(i)) |
Definition at line 111 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.str |
Definition at line 61 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.tensor = graph.Tensors(input_index) |
Definition at line 118 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.test_param = args.test_param |
Definition at line 67 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.test_params = test_param[0].split() |
Definition at line 76 of file gen_h5_explicit_inputs_all.py.
str gen_h5_explicit_inputs_all.testcase = f'{model_name}.{granularity}.{dtype}' |
Definition at line 95 of file gen_h5_explicit_inputs_all.py.
gen_h5_explicit_inputs_all.type |
Definition at line 41 of file gen_h5_explicit_inputs_all.py.