{"library":"spox","title":"Spox","type":"library","description":"A framework for constructing ONNX computational graphs programmatically. Current version 0.17.1, supports Python >=3.10, and follows a monthly/quarterly release cadence. Spox provides a high-level API to build, inline, and manipulate ONNX models with type-safe operators and shape inference.","language":"python","status":"active","last_verified":"Sat May 09","install":{"commands":["pip install spox"],"cli":null},"imports":["import spox","from spox import build, make_onnx_model","from spox.opset.ai.onnx import v17"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"https://spox.readthedocs.io","github":"https://github.com/quantco/spox","docs":null,"changelog":null,"pypi":"https://pypi.org/project/spox/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import spox\nfrom spox import build, make_onnx_model\nfrom spox.opset.ai.onnx import v17 as op\n\n# Build a simple model: Y = A * X + B\ndef build_linear_model():\n    A = spox.argument(spox.Tensor(spox.Float, (3, 3)))\n    X = spox.argument(spox.Tensor(spox.Float, (3, None)))\n    B = spox.argument(spox.Tensor(spox.Float, (1, None)))\n    Y = op.add(op.matmul(A, X), B)\n    return build(inputs={'A': A, 'X': X, 'B': B}, outputs={'Y': Y})\n\nmodel = build_linear_model()\nprint(make_onnx_model(model).SerializeToString()[:100])","lang":"python","description":"Construct an ONNX model for Y = A*X + B using Spox.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}