onnx-buf
v1.20.0-1
Published
Compiled Protobuf definitions for ONNX files
Readme
onnx-buf
This is an NPM package containing a lightweight compiled version of onnx.proto3 for JavaScript using @bufbuild/protobuf.
It can be imported and run from Node.js and Web.
Usage
npm i onnx-bufimport { create } from "@bufbuild/protobuf";
import {
TypeProtoSchema,
TypeProto_TensorSchema,
TensorShapeProtoSchema,
TensorShapeProto_DimensionSchema,
TensorProto_DataType,
} from "onnx-buf";
const typeProto = create(TypeProtoSchema, {
value: {
case: "tensorType",
value: create(TypeProto_TensorSchema, {
elemType: TensorProto_DataType.FLOAT,
shape: create(TensorShapeProtoSchema, {
dim: [
create(TensorShapeProto_DimensionSchema, {
value: { case: "dimValue", value: BigInt(1) },
}),
create(TensorShapeProto_DimensionSchema, {
value: { case: "dimValue", value: BigInt(3) },
}),
create(TensorShapeProto_DimensionSchema, {
value: { case: "dimValue", value: BigInt(244) },
}),
create(TensorShapeProto_DimensionSchema, {
value: { case: "dimValue", value: BigInt(244) },
}),
],
}),
}),
},
});
console.log(typeProto);Versioning
The version of this package tracks the onnx repository version, with an additional suffix for changes. For instance v1.20.0-0 of this repository is v1.20.0 of ONNX.
Updating
- Change
buf.gen.yamlwith the required configuration (new tag, etc.). - Run
pnpm i && pnpm build. - Change version and
pnpm publish.
