peal.architectures.onnx_predictor.inspect_onnx

peal.architectures.onnx_predictor.inspect_onnx(path)[source]

Declared interface of an ONNX graph.

Returns a dict with input_name, input_shape (list; symbolic dims are None), output_name, output_shape, num_outputs (the size of the last output axis, i.e. the number of classes for a classifier, or None when symbolic), opset and ir_version. Raises ValueError when the graph is not a single-input single-output model.

Parameters:

path (str) – Path of the .onnx file. External weight data is not loaded.

Returns:

Keys input_name, input_shape, output_name, output_shape, num_outputs, opset, ir_version and producer.

Return type:

dict

Raises:

ValueError – If the graph has more than one non-initializer input or no output.