ONE - On-device Neural Engine
Loading...
Searching...
No Matches
infer_testcases Namespace Reference

Functions

 eprint (*args, **kwargs)
 
 get_command_caf (infilename, outfilename, proto, caffemodel)
 
 get_command_tfl (infilename, outfilename, model_file)
 

Variables

str helpstr
 
int nproc = 1
 
int proc_num = 1
 
int min_argc = 8
 
dict args = {}
 
 argc = len(sys.argv)
 
 arg = sys.argv[i]
 
dict fw = args['-f']
 
dict build_path = args['-b']
 
dict testcases_dir = args['-t']
 
dict remove_existing = args['-r']
 
 model = sys.argv[-1]
 
 model_proto = sys.argv[-2]
 
 model_caffe = sys.argv[-1]
 
str hdf_suffix = '.hdf5'
 
str bin_suffix = '.dat'
 
int testcase_num = 0
 
 testcases = glob.glob(testcases_dir + '/testcase*')
 
 infile = glob.glob(testcase + '/input/*' + hdf_suffix)
 
str outfile = testcase + '/output/output' + hdf_suffix
 
str outfile_bin = testcase + '/output/output' + bin_suffix
 
 command = get_command_tfl(infile, outfile, model)
 

Function Documentation

◆ eprint()

infer_testcases.eprint ( args,
**  kwargs 
)

Definition at line 32 of file infer_testcases.py.

32def eprint(*args, **kwargs):
33 print(*args, file=sys.stderr, **kwargs)
34
35

◆ get_command_caf()

infer_testcases.get_command_caf (   infilename,
  outfilename,
  proto,
  caffemodel 
)

Definition at line 97 of file infer_testcases.py.

97def get_command_caf(infilename, outfilename, proto, caffemodel):
98 return [
99 build_path + "/tools/run/nnkit-run", "--pre",
100 build_path + "/actions/HDF5/libnnkit_HDF5_import_action.so", "--pre-arg",
101 infilename, "--backend", build_path + "/backends/caffe/libnnkit_caffe_backend.so",
102 "--backend-arg", proto, "--backend-arg", caffemodel, "--post",
103 build_path + "/actions/HDF5/libnnkit_HDF5_export_action.so", "--post-arg",
104 outfilename
105 ]
106
107

◆ get_command_tfl()

infer_testcases.get_command_tfl (   infilename,
  outfilename,
  model_file 
)

Definition at line 108 of file infer_testcases.py.

108def get_command_tfl(infilename, outfilename, model_file):
109 return [
110 build_path + "/tools/run/nnkit-run", "--pre",
111 build_path + "/actions/HDF5/libnnkit_HDF5_import_action.so", "--pre-arg",
112 infilename, "--backend",
113 build_path + "/backends/tflite/libnnkit_tflite_backend.so", "--backend-arg",
114 model_file, "--post", build_path + "/actions/builtin/libnnkit_show_action.so",
115 "--post", build_path + "/actions/HDF5/libnnkit_HDF5_export_action.so",
116 "--post-arg", outfilename
117 ]
118
119

Variable Documentation

◆ arg

infer_testcases.arg = sys.argv[i]

Definition at line 46 of file infer_testcases.py.

◆ argc

infer_testcases.argc = len(sys.argv)

Definition at line 44 of file infer_testcases.py.

◆ args

dict infer_testcases.args = {}

Definition at line 40 of file infer_testcases.py.

◆ bin_suffix

str infer_testcases.bin_suffix = '.dat'

Definition at line 94 of file infer_testcases.py.

◆ build_path

dict infer_testcases.build_path = args['-b']

Definition at line 72 of file infer_testcases.py.

◆ command

infer_testcases.command = get_command_tfl(infile, outfile, model)

Definition at line 141 of file infer_testcases.py.

◆ fw

dict infer_testcases.fw = args['-f']

Definition at line 71 of file infer_testcases.py.

◆ hdf_suffix

str infer_testcases.hdf_suffix = '.hdf5'

Definition at line 93 of file infer_testcases.py.

◆ helpstr

str infer_testcases.helpstr
Initial value:
1= "Expected arguments: -b <path_to_nnkit>" + \
2 "-f (tfl | caf) " + \
3 "-t <testcases_dir> " + \
4 "[-p <nporc> <proc_num>] " + \
5 "[-r] " + \
6 "(<tflite_model_file> | <caffe_prototxt_model> <caffe_caffemodel_file>)"

Definition at line 24 of file infer_testcases.py.

◆ infile

infer_testcases.infile = glob.glob(testcase + '/input/*' + hdf_suffix)

Definition at line 134 of file infer_testcases.py.

◆ min_argc

int infer_testcases.min_argc = 8

Definition at line 38 of file infer_testcases.py.

◆ model

infer_testcases.model = sys.argv[-1]

Definition at line 78 of file infer_testcases.py.

◆ model_caffe

infer_testcases.model_caffe = sys.argv[-1]

Definition at line 82 of file infer_testcases.py.

◆ model_proto

infer_testcases.model_proto = sys.argv[-2]

Definition at line 81 of file infer_testcases.py.

◆ nproc

infer_testcases.nproc = 1

Definition at line 36 of file infer_testcases.py.

◆ outfile

str infer_testcases.outfile = testcase + '/output/output' + hdf_suffix

Definition at line 137 of file infer_testcases.py.

◆ outfile_bin

str infer_testcases.outfile_bin = testcase + '/output/output' + bin_suffix

Definition at line 138 of file infer_testcases.py.

◆ proc_num

infer_testcases.proc_num = 1

Definition at line 37 of file infer_testcases.py.

◆ remove_existing

dict infer_testcases.remove_existing = args['-r']

Definition at line 75 of file infer_testcases.py.

◆ testcase_num

int infer_testcases.testcase_num = 0

Definition at line 120 of file infer_testcases.py.

◆ testcases

infer_testcases.testcases = glob.glob(testcases_dir + '/testcase*')

Definition at line 121 of file infer_testcases.py.

◆ testcases_dir

dict infer_testcases.testcases_dir = args['-t']

Definition at line 73 of file infer_testcases.py.