Sparse CPU Custom Ops#
This page lists all custom ONNX Runtime operators in the sparse CPU family provided by yet-another-onnxruntime-extensions. The catalogue is generated dynamically at documentation-build time by parsing the C++ source files, so it always reflects the actual implementation without any manual maintenance.
These operators are registered under the yaourt.ortops.sparse.cpu domain
and run on the CPUExecutionProvider. The pre-built shared library is
shipped inside the wheel and can be loaded via
SPARSE_CPU2_LIB_PATH.
Operators#
DenseToSparse#
Domain |
|
Execution provider |
|
Since version |
1 |
Converts a 2-D dense float32 tensor into a compact flat sparse encoding. Only non-zero elements are stored. The 1-D output tensor encodes the original shape, the number of non-zero elements, their flat indices (stored as uint32), and their values (float32). The encoding is suitable as input to SparseToDense for a lossless round-trip.
Constraints: input must be exactly 2-D; only float32 is supported.
Inputs
X(float32) — 2-D dense float32 input tensor of shape [n_rows, n_cols]. Zero elements are not stored in the sparse encoding.
Outputs
Y(float32) — 1-D float32 tensor containing the sparse encoding of X. Layout: header | flat indices (uint32) | non-zero values (float32).
SparseToDense#
Domain |
|
Execution provider |
|
Since version |
1 |
Converts the compact sparse encoding produced by DenseToSparse back into a 2-D dense float32 tensor. Positions that were zero in the original tensor are filled with 0.0. The output shape is recovered from the sparse header embedded in the input.
Constraints: input must be 1-D with a valid sparse header; the encoded shape must be 2-D; only float32 is supported.
Inputs
X(float32) — 1-D float32 sparse encoding produced by DenseToSparse.
Outputs
Y(float32) — Reconstructed 2-D dense float32 tensor. The shape is recovered from the sparse header embedded in X.