Skip to main content

Module tensor_primitives

Module tensor_primitives 

Source
Expand description

The framework’s curated floor of primitive tensor ops.

Every Backend impl MUST declare an atomic_opset() whose ops list contains every entry in TENSOR_PRIMITIVES_OPS. Ops not in this set (Relu, Sigmoid, Tanh, Softmax, LeakyRelu, Gelu, Conv, MaxPool, AveragePool, BatchNormalization, LayerNormalization, …) are extensions: a backend MAY support them via extension_opsets(); a graph using them either binds to a backend that declares them OR (future work) a lowering pass decomposes them into primitives.

Naming rationale — the op-types here live in the ai.onnx domain because that’s where Add, MatMul, Reshape, etc. are canonically named. The framework deliberately avoids ONNX_V1_* / onnx_v1 identifiers anywhere so users don’t read this floor as a claim to implement the ONNX v1 specification — the floor is OUR curation of primitives, not the formal ONNX v1 catalog.

Structs§

MissingPrimitives
Result of opset_covers_primitives when a backend’s declared opset is missing one or more entries from the floor.

Constants§

TENSOR_PRIMITIVES_DOMAIN
Canonical opset domain for the primitive tensor ops. Same string the upstream ONNX project uses for its op-type catalog.
TENSOR_PRIMITIVES_OPS
30 primitive tensor ops every Backend impl MUST declare.
TENSOR_PRIMITIVES_VERSION
Version of the framework’s primitive-tensor floor. Bumped when the set changes meaningfully.

Functions§

opset_covers_primitives
Confirm opset declares every primitive in TENSOR_PRIMITIVES_OPS. Returns the list of missing names so the caller surfaces a typed error instead of a flat boolean. Ops in opsets with a non-TENSOR_PRIMITIVES_DOMAIN domain don’t count toward the check — primitives are sourced from the canonical ai.onnx namespace.