-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[js/web] upgrade version of flatbuffers
- Loading branch information
Showing
47 changed files
with
3,507 additions
and
4,118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
# ORT Format File | ||
|
||
This directory contains [the generated ts file](ort-generated.ts) necessary to support the ORT file format. The file is generated from [the ORT file format schema](https://github.com/microsoft/onnxruntime/blob/d42399e1b07ce61e95aae88bc6b6ea5dcaae2011/onnxruntime/core/flatbuffers/schema/ort.fbs). Please do not directly modify [the generated ts header file](ort-generated.ts). | ||
This directory contains [the generated ts file](ort-generated.ts) necessary to support the ORT file format. The file is generated from [the ORT file format schema](https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/flatbuffers/schema/ort.fbs). Please do not directly modify [the generated ts header file](ort-generated.ts). | ||
|
||
[The ORT file format schema](https://github.com/microsoft/onnxruntime/blob/d42399e1b07ce61e95aae88bc6b6ea5dcaae2011/onnxruntime/core/flatbuffers/schema/ort.fbs) uses [FlatBuffers](https://github.com/google/flatbuffers) serialization library. To update [its generated ts file](ort-generated.ts), | ||
[The ORT file format schema](https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/flatbuffers/schema/ort.fbs) uses [FlatBuffers](https://github.com/google/flatbuffers) serialization library. To update [its generated ts file](ort-generated.ts), | ||
|
||
1. Download or locate the [ort.fbs](https://github.com/microsoft/onnxruntime/blob/d42399e1b07ce61e95aae88bc6b6ea5dcaae2011/onnxruntime/core/flatbuffers/schema/ort.fbs) file. | ||
2. Download FlatBuffers compiler: Download the latest flatc tool (flatc_windows.zip) from [Flatbuffers Release Page](https://github.com/google/flatbuffers/releases). Unzip and run | ||
1. Download or locate the [ort.fbs](https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/flatbuffers/schema/ort.fbs) file. | ||
2. Download FlatBuffers compiler: Download the latest flatc tool (Windows.flatc.binary.zip) from [Flatbuffers Release Page](https://github.com/google/flatbuffers/releases). Unzip and run | ||
|
||
`> flatc_windows.exe --ts <path to ort.fbs>` | ||
`> flatc.exe --ts ort.fbs` | ||
|
||
This should result in ort-generated.ts being updated. | ||
copy the generated folder `onnxruntime` to `js/web/lib/onnxjs/ort-schema/flatbuffers/` directory. | ||
|
||
Update ort-generated.ts to re-export from the generated file fbs.ts under the onnxruntime directory. |
41 changes: 41 additions & 0 deletions
41
js/web/lib/onnxjs/ort-schema/flatbuffers/onnxruntime/fbs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ | ||
|
||
export { ArgType } from './fbs/arg-type.js'; | ||
export { ArgTypeAndIndex } from './fbs/arg-type-and-index.js'; | ||
export { Attribute } from './fbs/attribute.js'; | ||
export { AttributeType } from './fbs/attribute-type.js'; | ||
export { DeprecatedKernelCreateInfos } from './fbs/deprecated-kernel-create-infos.js'; | ||
export { DeprecatedNodeIndexAndKernelDefHash } from './fbs/deprecated-node-index-and-kernel-def-hash.js'; | ||
export { DeprecatedSessionState } from './fbs/deprecated-session-state.js'; | ||
export { DeprecatedSubGraphSessionState } from './fbs/deprecated-sub-graph-session-state.js'; | ||
export { Dimension } from './fbs/dimension.js'; | ||
export { DimensionValue } from './fbs/dimension-value.js'; | ||
export { DimensionValueType } from './fbs/dimension-value-type.js'; | ||
export { EdgeEnd } from './fbs/edge-end.js'; | ||
export { Graph } from './fbs/graph.js'; | ||
export { InferenceSession } from './fbs/inference-session.js'; | ||
export { KernelTypeStrArgsEntry } from './fbs/kernel-type-str-args-entry.js'; | ||
export { KernelTypeStrResolver } from './fbs/kernel-type-str-resolver.js'; | ||
export { MapType } from './fbs/map-type.js'; | ||
export { Model } from './fbs/model.js'; | ||
export { Node } from './fbs/node.js'; | ||
export { NodeEdge } from './fbs/node-edge.js'; | ||
export { NodeType } from './fbs/node-type.js'; | ||
export { NodesToOptimizeIndices } from './fbs/nodes-to-optimize-indices.js'; | ||
export { OpIdKernelTypeStrArgsEntry } from './fbs/op-id-kernel-type-str-args-entry.js'; | ||
export { OperatorSetId } from './fbs/operator-set-id.js'; | ||
export { RuntimeOptimizationRecord } from './fbs/runtime-optimization-record.js'; | ||
export { RuntimeOptimizationRecordContainerEntry } from './fbs/runtime-optimization-record-container-entry.js'; | ||
export { RuntimeOptimizations } from './fbs/runtime-optimizations.js'; | ||
export { SequenceType } from './fbs/sequence-type.js'; | ||
export { Shape } from './fbs/shape.js'; | ||
export { SparseTensor } from './fbs/sparse-tensor.js'; | ||
export { StringStringEntry } from './fbs/string-string-entry.js'; | ||
export { Tensor } from './fbs/tensor.js'; | ||
export { TensorDataType } from './fbs/tensor-data-type.js'; | ||
export { TensorTypeAndShape } from './fbs/tensor-type-and-shape.js'; | ||
export { TypeInfo } from './fbs/type-info.js'; | ||
export { TypeInfoValue } from './fbs/type-info-value.js'; | ||
export { ValueInfo } from './fbs/value-info.js'; |
60 changes: 60 additions & 0 deletions
60
js/web/lib/onnxjs/ort-schema/flatbuffers/onnxruntime/fbs/arg-type-and-index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ | ||
|
||
import * as flatbuffers from 'flatbuffers'; | ||
|
||
import { ArgType } from '../../onnxruntime/fbs/arg-type.js'; | ||
|
||
export class ArgTypeAndIndex { | ||
bb: flatbuffers.ByteBuffer | null = null; | ||
bb_pos = 0; | ||
__init(i: number, bb: flatbuffers.ByteBuffer): ArgTypeAndIndex { | ||
this.bb_pos = i; | ||
this.bb = bb; | ||
return this; | ||
} | ||
|
||
static getRootAsArgTypeAndIndex(bb: flatbuffers.ByteBuffer, obj?: ArgTypeAndIndex): ArgTypeAndIndex { | ||
return (obj || new ArgTypeAndIndex()).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
|
||
static getSizePrefixedRootAsArgTypeAndIndex(bb: flatbuffers.ByteBuffer, obj?: ArgTypeAndIndex): ArgTypeAndIndex { | ||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); | ||
return (obj || new ArgTypeAndIndex()).__init(bb.readInt32(bb.position()) + bb.position(), bb); | ||
} | ||
|
||
argType(): ArgType { | ||
const offset = this.bb!.__offset(this.bb_pos, 4); | ||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : ArgType.INPUT; | ||
} | ||
|
||
index(): number { | ||
const offset = this.bb!.__offset(this.bb_pos, 6); | ||
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0; | ||
} | ||
|
||
static startArgTypeAndIndex(builder: flatbuffers.Builder) { | ||
builder.startObject(2); | ||
} | ||
|
||
static addArgType(builder: flatbuffers.Builder, argType: ArgType) { | ||
builder.addFieldInt8(0, argType, ArgType.INPUT); | ||
} | ||
|
||
static addIndex(builder: flatbuffers.Builder, index: number) { | ||
builder.addFieldInt32(1, index, 0); | ||
} | ||
|
||
static endArgTypeAndIndex(builder: flatbuffers.Builder): flatbuffers.Offset { | ||
const offset = builder.endObject(); | ||
return offset; | ||
} | ||
|
||
static createArgTypeAndIndex(builder: flatbuffers.Builder, argType: ArgType, index: number): flatbuffers.Offset { | ||
ArgTypeAndIndex.startArgTypeAndIndex(builder); | ||
ArgTypeAndIndex.addArgType(builder, argType); | ||
ArgTypeAndIndex.addIndex(builder, index); | ||
return ArgTypeAndIndex.endArgTypeAndIndex(builder); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
js/web/lib/onnxjs/ort-schema/flatbuffers/onnxruntime/fbs/arg-type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ | ||
|
||
export enum ArgType { | ||
INPUT = 0, | ||
OUTPUT = 1, | ||
} |
19 changes: 19 additions & 0 deletions
19
js/web/lib/onnxjs/ort-schema/flatbuffers/onnxruntime/fbs/attribute-type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ | ||
|
||
export enum AttributeType { | ||
UNDEFINED = 0, | ||
FLOAT = 1, | ||
INT = 2, | ||
STRING = 3, | ||
TENSOR = 4, | ||
GRAPH = 5, | ||
FLOATS = 6, | ||
INTS = 7, | ||
STRINGS = 8, | ||
TENSORS = 9, | ||
GRAPHS = 10, | ||
SPARSE_TENSOR = 11, | ||
SPARSE_TENSORS = 12, | ||
} |
Oops, something went wrong.