ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
minimal.py
Go to the documentation of this file.
1from onert import infer
2import sys
3
4
5def main(nnpackage_path, backends="cpu"):
6 # Create session and load nnpackage
7 # The default value of backends is "cpu".
8 session = infer.session(nnpackage_path, backends)
9
10 # Prepare input. Here we just allocate dummy input arrays.
11 input_size = session.input_size()
12 session.set_inputs(input_size)
13
14 outputs = session.inference()
15
16 print(f"nnpackage {nnpackage_path.split('/')[-1]} runs successfully.")
17 return
18
19
20if __name__ == "__main__":
21 argv = sys.argv[1:]
22 main(*argv)
int main(void)