Utils#

Analysis, Parsing#

onnxcustom.utils.nvprof2json.convert_trace_to_json (filename, output = None, temporary_file = None, verbose = 0, fLOG = None)

Converts traces produced by nvprof and saved with format sqlite3 (extension .sql). The output format follows Trace Event Format.

onnxcustom.utils.nvprof2json.json_to_dataframe (js)

Converts a json dump obtained with function convert_trace_to_json to a dataframe.

onnxcustom.utils.nvprof2json.json_to_dataframe_streaming (js, chunksize = 100000, flatten = False, kwargs)

Converts a big json dump (from convert_trace_to_json) to a dataframe. The function processes the data by streaming to avoid loading huge data in memory. Returns an iterator on dataframes. The function relies on pandas_streaming.

Labelling#

onnxcustom.utils.imagenet_classes.get_class_names ()

Returns the class names for the ImageNet competition as a dictionary.

Splitting#

onnxcustom.utils.onnx_split.split_onnx (onnx_model, n_parts = None, cut_points = None, verbose = 0, stats = False, fLOG = None)

Splits an ONNX model into n_parts consecutive subgraphs. Chained altogether, they are equivalent to the given model.

Time#

onnxcustom.utils.measure_time (stmt, context = None, repeat = 10, number = 50, div_by_number = False)

Measures a statement and returns the results as a dictionary.

Debugging#

onnxcustom.utils.str_ortvalue (ov)

Displays the content of an C_OrtValue.