API & Operator Docs
The native C++ engine implements 20 ONNX operators for float32 tensors. The browser runtime is a separate, much smaller Rust interpreter implementing 5 of them (MatMul, Add, Relu, Sigmoid, Softmax) — enough for the fraud model, not for CNNs. Models using anything else are rejected with an explicit reason, never run approximately.
Interfaces
import numpy as np, crucible_py
model = crucible_py.load_model("resnet18.onnx")
print(crucible_py.check_model(model)) # [] when every op/attribute is supported
x = np.random.rand(1, 3, 224, 224).astype(np.float32)
y = crucible_py.run(model, {"input": x}) # first output, float32 ndarraycurl -X POST $API/convert -H "Authorization: Bearer $TOKEN" \
-F model_file=@fraud_detector.onnx # -> onnx_model_id, unsupported_reasons
curl -X POST $API/infer -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"model_id":"<id>","input":[0,0,0,0,0,0,0],"input_shape":[1,7]}'CrucibleModel* m = crucible_load("model.onnx");
if (!m) { fprintf(stderr, "%s\n", crucible_last_error()); return 1; }
int64_t shape[2] = {1, 7};
CrucibleTensorDesc in = { shape, 2, 7, features };
float* out; CrucibleTensorDesc out_desc;
CrucibleStatus s = crucible_run(m, &in, 1, &out, &out_desc, 1);
crucible_free(m);import init, { runInference, modelInfo } from "/wasm/crucible_wasm.js";
await init();
const info = JSON.parse(modelInfo(bytes)); // supported, unsupported_reasons, inputs…
const y = runInference(bytes, new Float32Array(x), new Int32Array([1, 7]));Linear algebra
Matrix product via Eigen. WASM runtime: 2-D operands only.
A and B must be rank 2; C is broadcast to (M, N).
| alpha, beta | scales, default 1.0 |
| transA, transB | transpose flags, default 0 |
Numpy-style multidirectional broadcasting (both engines).
Activations
Elementwise.
Elementwise.
Elementwise.
Elementwise.
| alpha | default 0.01 |
Elementwise.
| alpha | default 1.0 |
Exact (erf) or tanh approximation.
| approximate | "none" (default) or "tanh" |
Opset ≥ 13 normalises one axis (default −1); opset < 13 uses the legacy 2-D coercion (default axis 1). Same semantics in the WASM runtime.
| axis | any valid axis |
Convolution & normalisation
2-D only. im2col + Eigen GEMM; 1×1 convolutions skip im2col; depthwise uses a direct loop.
| strides, pads | pads must be [top, left, bottom, right] |
| group | ≥ 1 (grouped and depthwise supported) |
| dilations | only 1 is supported |
| auto_pad | NOTSET or VALID only |
Inference mode only.
| epsilon | default 1e-5 |
| training_mode | must be 0 |
Pooling
2-D windows; the optional Indices output is not supported.
| kernel_shape | required |
| strides, pads | as Conv |
| ceil_mode, storage_order | must be 0 |
2-D windows.
| kernel_shape | required |
| ceil_mode | must be 0 |
Mean over the spatial dimensions.
Shape & plumbing
Target shape from the second input; supports 0 (copy input dim) and one −1.
| allowzero | must be 0 |
Metadata-only reshape.
| axis | default 1 |
All inputs share rank and every dim except axis.
| axis | required |
Pass-through.
Inference: identity. The optional mask output is not supported.