peal.architectures.onnx_predictor.OnnxPredictor¶
- class peal.architectures.onnx_predictor.OnnxPredictor[source]¶
Bases:
ModuleA trainable torch module converted from an ONNX classifier.
forwardtakes the same[B, C, H, W]float tensor the ONNX graph declared and returns its first output.sourceandinput_shapeare kept so the corrected model can be exported with the interface the user uploaded.- Parameters:
graph_module (
torch.fx.GraphModule) – The moduleonnx2torch.convertproduced.source (
str, optional) – Absolute path of the ONNX file the module came from.input_name (
str) – Name of the graph input, kept for re-export.input_shape (
listofintorNone, optional) – Declared input shape (symbolic dims asNone); used byexport_to_onnx()when no shape is given.
Methods
Run the converted graph and return its first output tensor (in chunks when the graph declares a fixed batch size).