Skip to main content

Module cpu

Module cpu 

Source
Expand description

Pure-Rust reference CPU backend. Implements bb::Backend for the ai.onnx v1 51-op subset over ndarray. Gated by the cpu-backend feature.

Re-exports§

pub use opset::ONNX_DOMAIN;
pub use opset::ONNX_V1_OPSET;
pub use opset::ONNX_VERSION;
pub use tensor::CpuTensor;
pub use tensor::CpuTensorError;
pub use graph_walker::execute_graph;
pub use graph_walker::BackendError;

Modules§

graph_walker
CpuBackend::execute_graph — walk a GraphProto body (the kind the compiler’s collapse_backend_subgraphs pass emits inside every BackendSubgraph_* FunctionProto) and run each NodeProto through the existing kernel dispatch.
ops
Per-op kernel dispatch for the CpuBackend.
opset
Opset declaration for the CpuBackend.
tensor
CpuTensorArc-shared handle to a CpuBackendBuffer holding an ndarray::ArrayD<f32>. Cloning the handle is an Arc::clone (O(1) refcount bump); the underlying buffer is owned by the backend and may be pooled or fresh-allocated by CpuBackend.

Structs§

CpuBackend
Reference CPU backend. Dispatches its opset onto ndarray kernels; storage is ArrayD<f32> end-to-end.

Functions§

dispatch_count
Read the current per-thread invocation count.
reset_dispatch_count
Reset the per-thread invocation count to zero.