liveBook · Manning

ONNX

As explained in Deep Learning with Python, Third Edition

An open format and runtime ecosystem for representing and executing trained machine-learning models outside the original training framework.

ONNX packages a trained model’s weights and computation graph outside the original Python program, allowing inference from environments such as C++ servers. This separates production prediction from training and can reduce serving overhead. section 6.3.2

Exporting a Keras model

Export a Keras model in ONNX format, load it with ONNX Runtime, and run predictions without the original training program. section 6.3.2

model.export("path/to/location", format="onnx")

ort_session = onnxruntime.InferenceSession("path/to/location")
predictions = ort_session.run(None, input_data)

Follow the complete export, session-loading, and prediction flow for ONNX inference. section 6.3.2

How Deep Learning with Python, Third Edition covers it

How deep it goes
Shows export and runtime execution, but defers detailed optimization and implementation internals.
Examples
Uses Keras export, ONNX Runtime session loading, and prediction execution as the concrete workflow.
What it assumes
Assumes a trained Keras model and basic familiarity with serving predictions.
What you can do after
Operate exported models through ONNX Runtime for production prediction.
How it connects
Connects model deployment with inference, computation graphs, REST APIs, Keras, and ONNX Runtime.

Also explained in

Compare how 7 books explain ONNX →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with Python, Third Edition. The section links point to the parts of the book it draws on.