@mauriciobenjamin700/ort-vision-sdk-web 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,74 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.9.0] - 2026-09-13
11
+
12
+ ### Fixed
13
+
14
+ - **A model exported with `half=True` now runs (#50).** Every task built its
15
+ feed as `Float32Array` and nothing read the element type the graph declares,
16
+ so a half-precision export loaded fine and threw on the first `predict()`:
17
+ `Unexpected input data type. Actual: (tensor(float)) , expected:
18
+ (tensor(float16))`. FP16 halves the artifact — 5.11 MB against 10.11 MB on a
19
+ detector, 10.41 against 20.78 on a classifier — which in a browser is the
20
+ difference between the page opening and not.
21
+
22
+ The declared type now comes out of the model file itself, in the same pass
23
+ the SDK already makes for `names`: `session.inputMetadata` is `undefined` on
24
+ `onnxruntime-web` 1.20.1, so the session cannot answer this. `OrtSession`
25
+ exposes it as `inputDtype`/`inputDtypes`, and `run()` converts any float32
26
+ feed whose input declares `float16` — one boundary, rather than the fourteen
27
+ `toFloat32Tensor` call sites the tasks are built from. Preprocessing stays in
28
+ `Float32Array` on purpose: `(value / 255 - mean) / std` in half precision
29
+ loses exactly the small differences normalization exists to preserve.
30
+
31
+ Outputs are widened back before decoding. Float16 resolves to 0.5 px around
32
+ coordinate 640 and 1.0 px around 1280, so decoding boxes in that type would
33
+ quantise every coordinate before NMS and the scale-back to original-image
34
+ pixels ever ran.
35
+
36
+ - **A browser without `Float16Array` is refused at `create()`, not at the first
37
+ frame.** ORT requires a real `Float16Array` for a half tensor — the same bits
38
+ in a `Uint16Array` are rejected — and not every browser has one. Loading a
39
+ half-precision model there now fails immediately with a message naming the
40
+ inputs and the missing global, instead of throwing from inside preprocessing
41
+ one frame later.
42
+
43
+ ### Added
44
+
45
+ - **`readModelInputTypes`, `tensorTypeFor`, `asFloat32Array`,
46
+ `hasFloat16Array`** and the `DEFAULT_TENSOR_TYPE` constant, for callers
47
+ driving `OrtSession` directly. `asFloat32Array` is the one to reach for when
48
+ reading a raw output: it passes a `Float32Array` through and widens anything
49
+ else.
50
+
51
+
52
+ ## [0.8.1] - 2026-09-04
53
+
54
+ ### Performance
55
+
56
+ - **`Probs.top5` selects five classes instead of ordering a thousand.** `_topK`
57
+ allocated one index per class, sorted the whole array with a JS comparator,
58
+ then kept five entries and discarded the rest — and `top5` and `top5conf` are
59
+ separate getters over the same selection, so a caller reading both paid for it
60
+ twice, once per frame in a camera loop.
61
+
62
+ Partial selection keeps `k` slots ordered by insertion and scans the vector
63
+ once: O(n·k), no allocation beyond the result. Measured on 1000 classes over
64
+ 2000 iterations, 134.5 µs became 1.5 µs for identical output. Each `k` is now
65
+ computed once per instance and cached, which is what makes reading both
66
+ getters cost one selection rather than two — the arrays handed back are the
67
+ cached ones, so treat them as read-only.
68
+
69
+ Ties still keep the lower class index first, matching the stable sort this
70
+ replaced and therefore the Python SDK's `np.argsort(-data, kind="stable")`.
71
+ `test/results.test.ts` pins that against the old full sort as an oracle over
72
+ 40 random vectors of integer-valued probabilities — integers so ties are
73
+ common rather than theoretical.
74
+
75
+ Web-only by design: the Python side sorts in C inside numpy, where this cost
76
+ does not arise.
77
+
10
78
  ## [0.8.0] - 2026-09-04
11
79
 
12
80
  ### Changed
@@ -620,7 +688,9 @@ console.log(r.boxes.xyxy, r.boxes.cls, r.boxes.conf, r.names);
620
688
  - Execution-provider resolution defaulting to `["webgpu", "wasm"]`.
621
689
  - Public types mirroring the Python SDK: `BoundingBox`, `ClassProbability`, `ClassificationResult`, `DetectionResult`, `RGBImage`.
622
690
 
623
- [Unreleased]: https://github.com/mauriciobenjamin700/ort-vision-sdk/compare/web-v0.8.0...HEAD
691
+ [Unreleased]: https://github.com/mauriciobenjamin700/ort-vision-sdk/compare/web-v0.9.0...HEAD
692
+ [0.9.0]: https://github.com/mauriciobenjamin700/ort-vision-sdk/compare/web-v0.8.1...web-v0.9.0
693
+ [0.8.1]: https://github.com/mauriciobenjamin700/ort-vision-sdk/compare/web-v0.8.0...web-v0.8.1
624
694
  [0.8.0]: https://github.com/mauriciobenjamin700/ort-vision-sdk/compare/web-v0.7.1...web-v0.8.0
625
695
  [0.7.1]: https://github.com/mauriciobenjamin700/ort-vision-sdk/compare/web-v0.7.0...web-v0.7.1
626
696
  [0.7.0]: https://github.com/mauriciobenjamin700/ort-vision-sdk/compare/web-v0.6.1...web-v0.7.0
@@ -0,0 +1,81 @@
1
+ /**
2
+ * What element type the graph declares, and what typed array that means.
3
+ *
4
+ * A model exported with `half=True` declares its input as `float16`, and ONNX
5
+ * Runtime refuses a float32 feed against it:
6
+ *
7
+ * ```text
8
+ * Unexpected input data type. Actual: (tensor(float)) , expected: (tensor(float16))
9
+ * ```
10
+ *
11
+ * The session opens without complaint, so the failure lands on the caller's
12
+ * first `predict()` rather than on `create()`. Preprocessing stays in
13
+ * `Float32Array` because that is where the normalization arithmetic belongs —
14
+ * `(value / 255 - mean) / std` in half precision loses exactly the small
15
+ * differences normalization exists to preserve — and the conversion happens
16
+ * once, at the feed boundary.
17
+ *
18
+ * Outputs travel the other way. Float16 carries 11 bits of mantissa, so at
19
+ * pixel scale its neighbouring values are 0.5 apart around coordinate 640 and
20
+ * 1.0 apart around 1280: decoding boxes in that type quantises every coordinate
21
+ * before NMS and the scale-back to original-image pixels ever run. {@link
22
+ * asFloat32Array} widens a half-precision output before the decoders touch it.
23
+ *
24
+ * `Float16Array` is what ORT requires for a half tensor — a `Uint16Array` of
25
+ * the same bits is rejected — and it is not in every browser yet, so
26
+ * {@link hasFloat16Array} exists to refuse at session creation instead of on
27
+ * the first frame.
28
+ */
29
+ /** The element type every task preprocesses to, and the fallback when unknown. */
30
+ export declare const DEFAULT_TENSOR_TYPE = "float32";
31
+ /**
32
+ * The structural surface of `Float16Array` this module needs.
33
+ *
34
+ * Declared here rather than pulled from `lib.es2025`: the package targets
35
+ * ES2022 so it builds for consumers on older TypeScript, and the only thing
36
+ * needed is "an array-like of numbers ORT recognises as half precision".
37
+ */
38
+ export interface Float16ArrayLike {
39
+ readonly length: number;
40
+ readonly buffer: ArrayBufferLike;
41
+ [index: number]: number;
42
+ }
43
+ /**
44
+ * Whether this environment can build a half-precision tensor at all.
45
+ *
46
+ * @returns `true` when the runtime exposes `Float16Array`. ORT rejects any
47
+ * other typed array for a `float16` tensor, so a `false` here means half
48
+ * precision is unreachable in this browser no matter what the model declares.
49
+ */
50
+ export declare function hasFloat16Array(): boolean;
51
+ /**
52
+ * Name the tensor type an ONNX element type maps to.
53
+ *
54
+ * @param elemType A `TensorProto.DataType` value read off the graph.
55
+ * @returns The ORT tensor type name, or `"float32"` for anything unrecognised —
56
+ * which is what every task produces anyway, so an unknown type surfaces as
57
+ * ORT's own type error against the real graph rather than as a lookup miss.
58
+ */
59
+ export declare function tensorTypeFor(elemType: number | undefined): string;
60
+ /**
61
+ * Convert a preprocessed float32 buffer to the type a feed must carry.
62
+ *
63
+ * @param data The preprocessed planar buffer.
64
+ * @param tensorType The tensor type the input declares, from
65
+ * {@link tensorTypeFor}.
66
+ * @returns `data` itself for a float32 input, or a `Float16Array` holding the
67
+ * same values for a half-precision one.
68
+ * @throws {RangeError} If half precision is asked for and the runtime has no
69
+ * `Float16Array`. Callers convert this into a `ModelLoadError` at session
70
+ * creation, so it never reaches a `predict()`.
71
+ */
72
+ export declare function toFeedData(data: Float32Array, tensorType: string): Float32Array | Float16ArrayLike;
73
+ /**
74
+ * Widen a model output to `Float32Array`, without copying when it already is.
75
+ *
76
+ * @param data A tensor's `data`, as ORT returned it.
77
+ * @returns The same values as a `Float32Array`. A float32 output is passed
78
+ * through untouched; anything else is copied once.
79
+ */
80
+ export declare function asFloat32Array(data: unknown): Float32Array;
81
+ //# sourceMappingURL=dtypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dtypes.d.ts","sourceRoot":"","sources":["../../src/core/dtypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAkBH,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAQD;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAGlE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,GAAG,YAAY,GAAG,gBAAgB,CAQlG;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAG1D"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * What element type the graph declares, and what typed array that means.
3
+ *
4
+ * A model exported with `half=True` declares its input as `float16`, and ONNX
5
+ * Runtime refuses a float32 feed against it:
6
+ *
7
+ * ```text
8
+ * Unexpected input data type. Actual: (tensor(float)) , expected: (tensor(float16))
9
+ * ```
10
+ *
11
+ * The session opens without complaint, so the failure lands on the caller's
12
+ * first `predict()` rather than on `create()`. Preprocessing stays in
13
+ * `Float32Array` because that is where the normalization arithmetic belongs —
14
+ * `(value / 255 - mean) / std` in half precision loses exactly the small
15
+ * differences normalization exists to preserve — and the conversion happens
16
+ * once, at the feed boundary.
17
+ *
18
+ * Outputs travel the other way. Float16 carries 11 bits of mantissa, so at
19
+ * pixel scale its neighbouring values are 0.5 apart around coordinate 640 and
20
+ * 1.0 apart around 1280: decoding boxes in that type quantises every coordinate
21
+ * before NMS and the scale-back to original-image pixels ever run. {@link
22
+ * asFloat32Array} widens a half-precision output before the decoders touch it.
23
+ *
24
+ * `Float16Array` is what ORT requires for a half tensor — a `Uint16Array` of
25
+ * the same bits is rejected — and it is not in every browser yet, so
26
+ * {@link hasFloat16Array} exists to refuse at session creation instead of on
27
+ * the first frame.
28
+ */
29
+ /** ONNX `TensorProto.DataType` values this SDK can name. */
30
+ const ELEM_TYPE_TO_TENSOR_TYPE = {
31
+ 1: "float32",
32
+ 2: "uint8",
33
+ 3: "int8",
34
+ 4: "uint16",
35
+ 5: "int16",
36
+ 6: "int32",
37
+ 7: "int64",
38
+ 9: "bool",
39
+ 10: "float16",
40
+ 11: "float64",
41
+ 12: "uint32",
42
+ 13: "uint64",
43
+ };
44
+ /** The element type every task preprocesses to, and the fallback when unknown. */
45
+ export const DEFAULT_TENSOR_TYPE = "float32";
46
+ const FLOAT16_ARRAY = globalThis.Float16Array;
47
+ /**
48
+ * Whether this environment can build a half-precision tensor at all.
49
+ *
50
+ * @returns `true` when the runtime exposes `Float16Array`. ORT rejects any
51
+ * other typed array for a `float16` tensor, so a `false` here means half
52
+ * precision is unreachable in this browser no matter what the model declares.
53
+ */
54
+ export function hasFloat16Array() {
55
+ return FLOAT16_ARRAY !== undefined;
56
+ }
57
+ /**
58
+ * Name the tensor type an ONNX element type maps to.
59
+ *
60
+ * @param elemType A `TensorProto.DataType` value read off the graph.
61
+ * @returns The ORT tensor type name, or `"float32"` for anything unrecognised —
62
+ * which is what every task produces anyway, so an unknown type surfaces as
63
+ * ORT's own type error against the real graph rather than as a lookup miss.
64
+ */
65
+ export function tensorTypeFor(elemType) {
66
+ if (elemType === undefined)
67
+ return DEFAULT_TENSOR_TYPE;
68
+ return ELEM_TYPE_TO_TENSOR_TYPE[elemType] ?? DEFAULT_TENSOR_TYPE;
69
+ }
70
+ /**
71
+ * Convert a preprocessed float32 buffer to the type a feed must carry.
72
+ *
73
+ * @param data The preprocessed planar buffer.
74
+ * @param tensorType The tensor type the input declares, from
75
+ * {@link tensorTypeFor}.
76
+ * @returns `data` itself for a float32 input, or a `Float16Array` holding the
77
+ * same values for a half-precision one.
78
+ * @throws {RangeError} If half precision is asked for and the runtime has no
79
+ * `Float16Array`. Callers convert this into a `ModelLoadError` at session
80
+ * creation, so it never reaches a `predict()`.
81
+ */
82
+ export function toFeedData(data, tensorType) {
83
+ if (tensorType !== "float16")
84
+ return data;
85
+ if (FLOAT16_ARRAY === undefined) {
86
+ throw new RangeError("This model declares a float16 input, but this environment has no Float16Array.");
87
+ }
88
+ return new FLOAT16_ARRAY(data);
89
+ }
90
+ /**
91
+ * Widen a model output to `Float32Array`, without copying when it already is.
92
+ *
93
+ * @param data A tensor's `data`, as ORT returned it.
94
+ * @returns The same values as a `Float32Array`. A float32 output is passed
95
+ * through untouched; anything else is copied once.
96
+ */
97
+ export function asFloat32Array(data) {
98
+ if (data instanceof Float32Array)
99
+ return data;
100
+ return Float32Array.from(data);
101
+ }
102
+ //# sourceMappingURL=dtypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dtypes.js","sourceRoot":"","sources":["../../src/core/dtypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,4DAA4D;AAC5D,MAAM,wBAAwB,GAAqC;IACjE,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,MAAM;IACT,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,QAAQ;CACb,CAAC;AAEF,kFAAkF;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAmB7C,MAAM,aAAa,GAAI,UAAyD,CAAC,YAAY,CAAC;AAE9F;;;;;;GAMG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,aAAa,KAAK,SAAS,CAAC;AACrC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,QAA4B;IACxD,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,mBAAmB,CAAC;IACvD,OAAO,wBAAwB,CAAC,QAAQ,CAAC,IAAI,mBAAmB,CAAC;AACnE,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,IAAkB,EAAE,UAAkB;IAC/D,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,IAAI,UAAU,CAClB,gFAAgF,CACjF,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,IAAa;IAC1C,IAAI,IAAI,YAAY,YAAY;QAAE,OAAO,IAAI,CAAC;IAC9C,OAAO,YAAY,CAAC,IAAI,CAAC,IAAyB,CAAC,CAAC;AACtD,CAAC"}
@@ -22,6 +22,21 @@
22
22
  * cannot be walked.
23
23
  */
24
24
  export declare function readModelMetadata(model: Uint8Array | ArrayBufferLike): Readonly<Record<string, string>>;
25
+ /**
26
+ * Read the element type each graph input declares.
27
+ *
28
+ * `onnxruntime-web` does not expose this. `session.inputMetadata` is
29
+ * `undefined` on 1.20.1 — the same version where `declaredShapesFrom` comes
30
+ * back empty — so the declared types have to come from the file, which the SDK
31
+ * already downloads and walks for {@link readModelMetadata}. Same bytes, one
32
+ * more pass, no extra request.
33
+ *
34
+ * @param model The `.onnx` file contents.
35
+ * @returns Input name → `TensorProto.DataType` value. An empty object when the
36
+ * file carries no readable graph, which every caller treats as "assume
37
+ * float32" — the behaviour before any of this existed.
38
+ */
39
+ export declare function readModelInputTypes(model: Uint8Array | ArrayBufferLike): Readonly<Record<string, number>>;
25
40
  /**
26
41
  * Read the class names an export baked into the model metadata.
27
42
  *
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/core/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAyIH;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,UAAU,GAAG,eAAe,GAClC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAqBlC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,GACrD,SAAS,MAAM,EAAE,GAAG,IAAI,CAE1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,MAAM,EAAE,GAAG,IAAI,CA6BhF"}
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/core/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAyJH;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,UAAU,GAAG,eAAe,GAClC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAqBlC;AA2FD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,UAAU,GAAG,eAAe,GAClC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkClC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,GACrD,SAAS,MAAM,EAAE,GAAG,IAAI,CAE1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,MAAM,EAAE,GAAG,IAAI,CA6BhF"}
@@ -15,6 +15,17 @@
15
15
  */
16
16
  /** Field number of `metadata_props` in `ModelProto` (repeated StringStringEntryProto). */
17
17
  const MODEL_METADATA_PROPS_FIELD = 14;
18
+ /** Field number of `graph` in `ModelProto` (GraphProto). */
19
+ const MODEL_GRAPH_FIELD = 7;
20
+ /** Field number of `input` in `GraphProto` (repeated ValueInfoProto). */
21
+ const GRAPH_INPUT_FIELD = 11;
22
+ /** Field numbers of `name` and `type` in `ValueInfoProto`. */
23
+ const VALUE_INFO_NAME_FIELD = 1;
24
+ const VALUE_INFO_TYPE_FIELD = 2;
25
+ /** Field number of `tensor_type` in `TypeProto` (TypeProto.Tensor). */
26
+ const TYPE_TENSOR_FIELD = 1;
27
+ /** Field number of `elem_type` in `TypeProto.Tensor` (a `TensorProto.DataType`). */
28
+ const TENSOR_ELEM_TYPE_FIELD = 1;
18
29
  /** Field numbers of `key` and `value` in `StringStringEntryProto`. */
19
30
  const ENTRY_KEY_FIELD = 1;
20
31
  const ENTRY_VALUE_FIELD = 2;
@@ -168,6 +179,150 @@ export function readModelMetadata(model) {
168
179
  }
169
180
  return metadata;
170
181
  }
182
+ /**
183
+ * Read the element type of a `TypeProto.Tensor` message.
184
+ *
185
+ * @param bytes The whole model buffer.
186
+ * @param start Offset of the message's first byte.
187
+ * @param end Offset one past its last byte.
188
+ * @returns The `TensorProto.DataType` value, or `null` when the message
189
+ * carries none or cannot be walked.
190
+ */
191
+ function readTensorElemType(bytes, start, end) {
192
+ const cursor = { bytes, end, pos: start };
193
+ while (cursor.pos < cursor.end) {
194
+ const tag = readVarint(cursor);
195
+ if (tag === null)
196
+ return null;
197
+ const field = tag >>> 3;
198
+ const wireType = tag & 0x07;
199
+ if (field === TENSOR_ELEM_TYPE_FIELD && wireType === WIRE_VARINT) {
200
+ return readVarint(cursor);
201
+ }
202
+ if (!skipField(cursor, wireType))
203
+ return null;
204
+ }
205
+ return null;
206
+ }
207
+ /**
208
+ * Read the element type out of a `TypeProto`, which wraps the tensor type.
209
+ *
210
+ * @param bytes The whole model buffer.
211
+ * @param start Offset of the message's first byte.
212
+ * @param end Offset one past its last byte.
213
+ * @returns The `TensorProto.DataType` value, or `null` for a non-tensor type
214
+ * (sequence, map, optional) or an unreadable message.
215
+ */
216
+ function readTypeElemType(bytes, start, end) {
217
+ const cursor = { bytes, end, pos: start };
218
+ while (cursor.pos < cursor.end) {
219
+ const tag = readVarint(cursor);
220
+ if (tag === null)
221
+ return null;
222
+ const field = tag >>> 3;
223
+ const wireType = tag & 0x07;
224
+ if (field === TYPE_TENSOR_FIELD && wireType === WIRE_LENGTH_DELIMITED) {
225
+ const range = readLengthDelimited(cursor);
226
+ if (range === null)
227
+ return null;
228
+ return readTensorElemType(bytes, range.start, range.end);
229
+ }
230
+ if (!skipField(cursor, wireType))
231
+ return null;
232
+ }
233
+ return null;
234
+ }
235
+ /**
236
+ * Read one `ValueInfoProto` into a name/element-type pair.
237
+ *
238
+ * @param bytes The whole model buffer.
239
+ * @param start Offset of the message's first byte.
240
+ * @param end Offset one past its last byte.
241
+ * @returns The pair, or `null` when either half is missing or unreadable.
242
+ */
243
+ function readValueInfo(bytes, start, end) {
244
+ const cursor = { bytes, end, pos: start };
245
+ let name = null;
246
+ let elemType = null;
247
+ while (cursor.pos < cursor.end) {
248
+ const tag = readVarint(cursor);
249
+ if (tag === null)
250
+ return null;
251
+ const field = tag >>> 3;
252
+ const wireType = tag & 0x07;
253
+ if (wireType === WIRE_LENGTH_DELIMITED) {
254
+ const range = readLengthDelimited(cursor);
255
+ if (range === null)
256
+ return null;
257
+ if (field === VALUE_INFO_NAME_FIELD) {
258
+ name = new TextDecoder("utf-8", { fatal: false }).decode(bytes.subarray(range.start, range.end));
259
+ }
260
+ else if (field === VALUE_INFO_TYPE_FIELD) {
261
+ elemType = readTypeElemType(bytes, range.start, range.end);
262
+ }
263
+ continue;
264
+ }
265
+ if (!skipField(cursor, wireType))
266
+ return null;
267
+ }
268
+ if (name === null || elemType === null)
269
+ return null;
270
+ return [name, elemType];
271
+ }
272
+ /**
273
+ * Read the element type each graph input declares.
274
+ *
275
+ * `onnxruntime-web` does not expose this. `session.inputMetadata` is
276
+ * `undefined` on 1.20.1 — the same version where `declaredShapesFrom` comes
277
+ * back empty — so the declared types have to come from the file, which the SDK
278
+ * already downloads and walks for {@link readModelMetadata}. Same bytes, one
279
+ * more pass, no extra request.
280
+ *
281
+ * @param model The `.onnx` file contents.
282
+ * @returns Input name → `TensorProto.DataType` value. An empty object when the
283
+ * file carries no readable graph, which every caller treats as "assume
284
+ * float32" — the behaviour before any of this existed.
285
+ */
286
+ export function readModelInputTypes(model) {
287
+ const bytes = model instanceof Uint8Array ? model : new Uint8Array(model);
288
+ const cursor = { bytes, end: bytes.length, pos: 0 };
289
+ const types = {};
290
+ while (cursor.pos < cursor.end) {
291
+ const tag = readVarint(cursor);
292
+ if (tag === null)
293
+ break;
294
+ const field = tag >>> 3;
295
+ const wireType = tag & 0x07;
296
+ if (field === MODEL_GRAPH_FIELD && wireType === WIRE_LENGTH_DELIMITED) {
297
+ const graph = readLengthDelimited(cursor);
298
+ if (graph === null)
299
+ break;
300
+ const inner = { bytes, end: graph.end, pos: graph.start };
301
+ while (inner.pos < inner.end) {
302
+ const innerTag = readVarint(inner);
303
+ if (innerTag === null)
304
+ break;
305
+ const innerField = innerTag >>> 3;
306
+ const innerWire = innerTag & 0x07;
307
+ if (innerField === GRAPH_INPUT_FIELD && innerWire === WIRE_LENGTH_DELIMITED) {
308
+ const range = readLengthDelimited(inner);
309
+ if (range === null)
310
+ break;
311
+ const info = readValueInfo(bytes, range.start, range.end);
312
+ if (info)
313
+ types[info[0]] = info[1];
314
+ continue;
315
+ }
316
+ if (!skipField(inner, innerWire))
317
+ break;
318
+ }
319
+ continue;
320
+ }
321
+ if (!skipField(cursor, wireType))
322
+ break;
323
+ }
324
+ return types;
325
+ }
171
326
  /**
172
327
  * Read the class names an export baked into the model metadata.
173
328
  *
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/core/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,0FAA0F;AAC1F,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAEtC,sEAAsE;AACtE,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,mDAAmD;AACnD,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB;;;;GAIG;AACH,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,CAAC;AAShC;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,MAAc;IAChC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAE,CAAC;QACvC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAChB,MAAM,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,MAAM,CAAC;QACvC,KAAK,IAAI,CAAC,CAAC;QACX,IAAI,KAAK,GAAG,EAAE;YAAE,OAAO,IAAI,CAAC;IAC9B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,SAAS,CAAC,MAAc,EAAE,QAAgB;IACjD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,WAAW;YACd,OAAO,UAAU,CAAC,MAAM,C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s on WASM and is told nothing.
70
70
  */
71
71
  readonly requestedProviders: readonly string[];
72
+ /**
73
+ * Tensor type each input declares, keyed by input name.
74
+ *
75
+ * Read from the model file, not from the session: `inputMetadata` is
76
+ * `undefined` on `onnxruntime-web` 1.20.1. Empty when the bytes were never
77
+ * in hand — a URL loaded with `readMetadata: false` — in which case every
78
+ * feed is built as float32, the behaviour before this existed.
79
+ */
80
+ private readonly _inputTypes;
72
81
  private constructor();
73
82
  /**
74
83
  * Load an ONNX model into an ORT inference session.
@@ -89,6 +98,16 @@ export declare class OrtSession {
89
98
  * @throws {@link ModelLoadError} if the model cannot be loaded.
90
99
  */
91
100
  static create(model: ModelSource, options?: OrtSessionOptions): Promise<OrtSession>;
101
+ /**
102
+ * Tensor type each input declares, in declaration order.
103
+ *
104
+ * `"float32"` for a normal export, `"float16"` for one exported with
105
+ * `half=True`. ORT matches a feed's type against this exactly, so the tasks
106
+ * read it and convert at the feed boundary.
107
+ */
108
+ get inputDtypes(): readonly string[];
109
+ /** Tensor type the first input declares. */
110
+ get inputDtype(): string;
92
111
  /** Names of the model's inputs, in declaration order. */
93
112
  get inputNames(): readonly string[];
94
113
  /** Name of the first (and usually only) input. */
@@ -149,5 +168,20 @@ export declare class OrtSession {
149
168
  * @throws {@link InferenceError} if ORT raises any error during execution.
150
169
  */
151
170
  run(feeds: Record<string, ort.Tensor>): Promise<Record<string, ort.Tensor>>;
171
+ /**
172
+ * Rebuild any feed whose type does not match what its input declares.
173
+ *
174
+ * ORT matches feed types against the graph exactly: a float32 tensor against
175
+ * a `half=True` export fails the run with `Unexpected input data type`. Every
176
+ * preprocessing path in this SDK produces `Float32Array`, on purpose — the
177
+ * normalization arithmetic belongs in single precision — so the conversion
178
+ * happens here, once, at the only boundary all of them pass through. A feed
179
+ * that already carries the declared type is handed on untouched, so a caller
180
+ * building its own half tensor pays nothing.
181
+ *
182
+ * @param feeds The tensors to run with.
183
+ * @returns The same mapping, with mismatched float32 feeds converted.
184
+ */
185
+ private _asDeclaredTypes;
152
186
  }
153
187
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/core/session.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAI5C,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,YAAY,CAAC;AAIpE,kDAAkD;AAClD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,eAAe,GAAG,UAAU,CAAC;AA+ChE,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,2EAA2E;IAC3E,QAAQ,CAAC,cAAc,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,cAAc,CAAC;IAC9D;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AA4BD;;;;;;GAMG;AACH,qBAAa,UAAU;IAEnB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB;;;;;;;;;;;;;;;;OAgBG;aACa,SAAS,EAAE,SAAS,MAAM,EAAE;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B;;;;;OAKG;aACa,kBAAkB,EAAE,SAAS,MAAM,EAAE;IA3BvD,OAAO;IA8BP;;;;;;;;;;;;;;;;;OAiBG;WACU,MAAM,CACjB,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC;IAuCtB,yDAAyD;IACzD,IAAI,UAAU,IAAI,SAAS,MAAM,EAAE,CAElC;IAED,kDAAkD;IAClD,IAAI,SAAS,IAAI,MAAM,CAMtB;IAED,0DAA0D;IAC1D,IAAI,WAAW,IAAI,SAAS,MAAM,EAAE,CAEnC;IAED;;;;;;OAMG;IACH,IAAI,WAAW,IAAI,SAAS,aAAa,EAAE,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