[code-reflection] RFR: Updating the ONNX CNNTest

Adam Pocock duke at openjdk.org
Mon Feb 10 19:07:50 UTC 2025


- Adds a Python script which trains a small LeNet style CNN on MNIST, exporting it to ONNX format.
- Updates the CNNTest to match the trained CNN.
- Added support for loading in the ONNX model, extracting the weights and saving them out in serialized Java records (this adds protobuf-java as a dependency along with the compiled ONNX protobuf).

The compiled ONNX protobuf is Apache 2.0 licensed, and the Python script is adapted from a PyTorch tutorial which is BSD licensed.

-------------

Commit messages:
 - Removing more whitespace generated by protoc.
 - Removing whitespace from generated protobuf.
 - Remove extraneous whitespace
 - CNNTest shape & flatten fix.
 - Adding a Python script to generate a CNN, updating the CNN code model.

Changes: https://git.openjdk.org/babylon/pull/307/files
  Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=307&range=00
  Stats: 47795 lines in 6 files changed: 47687 ins; 33 del; 75 mod
  Patch: https://git.openjdk.org/babylon/pull/307.diff
  Fetch: git fetch https://git.openjdk.org/babylon.git pull/307/head:pull/307

PR: https://git.openjdk.org/babylon/pull/307


More information about the babylon-dev mailing list