Skip to main content

Module onnx

Module onnx 

Source
Expand description

ONNX checkpoint loading: weights are the graph’s initializer tensors.

ONNX is protobuf, but the weight layout only needs a handful of fields (ModelProto.graph → GraphProto.initializer → TensorProto), so this module decodes the protobuf wire format directly — no protoc / prost build-time dependency. Both storage layouts are handled: raw_data bytes and the typed repeated fields (float_data, int32_data, …), packed or unpacked. F32/F16/BF16 are preserved exactly; DOUBLE and integer/bool types are cast to F32 with a note. Models using external data files are rejected with guidance.

Functions§

load_onnx