{"library":"onnx-proto","title":"ONNX Protobuf Definitions for JavaScript","description":"This `onnx-proto` package provides pre-compiled Protobuf definitions for the Open Neural Network Exchange (ONNX) format, specifically derived from the upstream `onnx/onnx.proto3` file. It enables JavaScript and TypeScript projects to interact with ONNX models by offering type-safe access to the ONNX IR (Intermediate Representation) structures, encompassing messages like `ModelProto`, `GraphProto`, `NodeProto`, and `TensorProto`. The current stable version is 8.0.1, reflecting the latest ONNX IR_VERSION 8 (corresponding to ONNX v1.10.2). Releases are automatically published to npm from the master branch whenever the underlying ONNX definition is updated or significant maintenance occurs, ensuring developers have timely access to the latest ONNX specification. Its key differentiator is being a direct, pre-compiled, and type-safe representation of the official ONNX protobuf schema, saving users the complexity of generating Protobuf code themselves for JavaScript and TypeScript environments.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install onnx-proto"],"cli":null},"imports":["import { onnx } from 'onnx-proto';","import { onnx } from 'onnx-proto'; // Access via onnx.TensorProto","import { onnx } from 'onnx-proto'; // Access via onnx.ModelProto"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { onnx } from 'onnx-proto';\n\n// Create a simple ONNX TensorProto object\nconst tensorProto = onnx.TensorProto.create({\n  dims: [2, 2],\n  dataType: onnx.TensorProto.DataType.FLOAT,\n  floatData: [1.0, 2.0, 3.0, 4.0]\n});\n\nconsole.log('Created ONNX TensorProto:');\nconsole.log(JSON.stringify(tensorProto.toJSON(), null, 2));\n\n// Access an enum value from the ONNX definition\nconst floatDataType = onnx.TensorProto.DataType.FLOAT;\nconsole.log(`\\nONNX TensorProto.DataType.FLOAT value: ${floatDataType}`);\n\n// This package provides type definitions and constructors for ONNX structures.\n// It does not include an ONNX runtime. For model inference, a separate\n// runtime library (e.g., onnxruntime-web) is required.\n","lang":"typescript","description":"Demonstrates how to import the `onnx` namespace and construct a basic `TensorProto` using its static `create` method, illustrating the package's utility for creating ONNX data structures.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}