@weavelogic/knowledge-graph-agent 0.7.4 → 0.8.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/dist/_virtual/__vite-browser-external.js +2 -2
- package/dist/_virtual/__vite-browser-external.js.map +1 -1
- package/dist/_virtual/browser.js +2 -3
- package/dist/_virtual/browser.js.map +1 -1
- package/dist/_virtual/index10.js +2 -4
- package/dist/_virtual/index10.js.map +1 -1
- package/dist/_virtual/index11.js +2 -2
- package/dist/cli/commands/hive-mind/add-frontmatter.js +2 -2
- package/dist/cli/commands/hive-mind/add-frontmatter.js.map +1 -1
- package/dist/cli/commands/hive-mind/analyze-links.js +2 -2
- package/dist/cli/commands/hive-mind/analyze-links.js.map +1 -1
- package/dist/cli/commands/hive-mind/find-connections.js +2 -2
- package/dist/cli/commands/hive-mind/find-connections.js.map +1 -1
- package/dist/cli/commands/hive-mind/validate-names.js +2 -2
- package/dist/cli/commands/hive-mind/validate-names.js.map +1 -1
- package/dist/graphql/server.js +2 -2
- package/dist/graphql/server.js.map +1 -1
- package/dist/mcp-server/tools/audit/index.d.ts +4 -0
- package/dist/mcp-server/tools/audit/index.d.ts.map +1 -1
- package/dist/node_modules/@typescript-eslint/project-service/dist/index.js +1 -1
- package/dist/node_modules/debug/src/browser.js +1 -1
- package/dist/node_modules/fdir/dist/index.js +14 -14
- package/dist/node_modules/fdir/dist/index.js.map +1 -1
- package/dist/node_modules/tinyglobby/dist/index.js +14 -14
- package/dist/node_modules/tinyglobby/dist/index.js.map +1 -1
- package/dist/node_modules/ts-api-utils/lib/index.js +1 -1
- package/dist/node_modules/typescript/lib/typescript.js +24 -24
- package/dist/node_modules/typescript/lib/typescript.js.map +1 -1
- package/dist/vector/services/embedding-service.js +1 -7
- package/dist/vector/services/embedding-service.js.map +1 -1
- package/package.json +2 -1
- package/dist/_virtual/browser2.js +0 -5
- package/dist/_virtual/browser2.js.map +0 -1
- package/dist/_virtual/index12.js +0 -5
- package/dist/_virtual/index12.js.map +0 -1
- package/dist/_virtual/ort-web.min.js +0 -8
- package/dist/_virtual/ort-web.min.js.map +0 -1
- package/dist/_virtual/ort-web.min2.js +0 -5
- package/dist/_virtual/ort-web.min2.js.map +0 -1
- package/dist/node_modules/@huggingface/jinja/dist/index.js +0 -118
- package/dist/node_modules/@huggingface/jinja/dist/index.js.map +0 -1
- package/dist/node_modules/@xenova/transformers/src/backends/onnx.js +0 -24
- package/dist/node_modules/@xenova/transformers/src/backends/onnx.js.map +0 -1
- package/dist/node_modules/@xenova/transformers/src/configs.js +0 -52
- package/dist/node_modules/@xenova/transformers/src/configs.js.map +0 -1
- package/dist/node_modules/@xenova/transformers/src/env.js +0 -35
- package/dist/node_modules/@xenova/transformers/src/env.js.map +0 -1
- package/dist/node_modules/@xenova/transformers/src/models.js +0 -3852
- package/dist/node_modules/@xenova/transformers/src/models.js.map +0 -1
- package/dist/node_modules/@xenova/transformers/src/tokenizers.js +0 -144
- package/dist/node_modules/@xenova/transformers/src/tokenizers.js.map +0 -1
- package/dist/node_modules/@xenova/transformers/src/utils/core.js +0 -52
- package/dist/node_modules/@xenova/transformers/src/utils/core.js.map +0 -1
- package/dist/node_modules/@xenova/transformers/src/utils/generation.js +0 -623
- package/dist/node_modules/@xenova/transformers/src/utils/generation.js.map +0 -1
- package/dist/node_modules/@xenova/transformers/src/utils/hub.js +0 -395
- package/dist/node_modules/@xenova/transformers/src/utils/hub.js.map +0 -1
- package/dist/node_modules/@xenova/transformers/src/utils/image.js +0 -12
- package/dist/node_modules/@xenova/transformers/src/utils/image.js.map +0 -1
- package/dist/node_modules/@xenova/transformers/src/utils/maths.js +0 -89
- package/dist/node_modules/@xenova/transformers/src/utils/maths.js.map +0 -1
- package/dist/node_modules/@xenova/transformers/src/utils/tensor.js +0 -750
- package/dist/node_modules/@xenova/transformers/src/utils/tensor.js.map +0 -1
- package/dist/node_modules/onnxruntime-common/dist/lib/backend-impl.js +0 -67
- package/dist/node_modules/onnxruntime-common/dist/lib/backend-impl.js.map +0 -1
- package/dist/node_modules/onnxruntime-common/dist/lib/env-impl.js +0 -24
- package/dist/node_modules/onnxruntime-common/dist/lib/env-impl.js.map +0 -1
- package/dist/node_modules/onnxruntime-common/dist/lib/env.js +0 -6
- package/dist/node_modules/onnxruntime-common/dist/lib/env.js.map +0 -1
- package/dist/node_modules/onnxruntime-common/dist/lib/index.js +0 -11
- package/dist/node_modules/onnxruntime-common/dist/lib/index.js.map +0 -1
- package/dist/node_modules/onnxruntime-common/dist/lib/inference-session-impl.js +0 -162
- package/dist/node_modules/onnxruntime-common/dist/lib/inference-session-impl.js.map +0 -1
- package/dist/node_modules/onnxruntime-common/dist/lib/inference-session.js +0 -6
- package/dist/node_modules/onnxruntime-common/dist/lib/inference-session.js.map +0 -1
- package/dist/node_modules/onnxruntime-common/dist/lib/tensor-impl.js +0 -393
- package/dist/node_modules/onnxruntime-common/dist/lib/tensor-impl.js.map +0 -1
- package/dist/node_modules/onnxruntime-common/dist/lib/tensor.js +0 -6
- package/dist/node_modules/onnxruntime-common/dist/lib/tensor.js.map +0 -1
- package/dist/node_modules/onnxruntime-web/dist/ort-web.min.js +0 -12919
- package/dist/node_modules/onnxruntime-web/dist/ort-web.min.js.map +0 -1
- package/dist/node_modules/ws/browser.js +0 -16
- package/dist/node_modules/ws/browser.js.map +0 -1
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
const isBigInt64ArrayAvailable = typeof BigInt64Array !== "undefined" && typeof BigInt64Array.from === "function";
|
|
2
|
-
const isBigUint64ArrayAvailable = typeof BigUint64Array !== "undefined" && typeof BigUint64Array.from === "function";
|
|
3
|
-
const NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP = /* @__PURE__ */ new Map([
|
|
4
|
-
["float32", Float32Array],
|
|
5
|
-
["uint8", Uint8Array],
|
|
6
|
-
["int8", Int8Array],
|
|
7
|
-
["uint16", Uint16Array],
|
|
8
|
-
["int16", Int16Array],
|
|
9
|
-
["int32", Int32Array],
|
|
10
|
-
["bool", Uint8Array],
|
|
11
|
-
["float64", Float64Array],
|
|
12
|
-
["uint32", Uint32Array]
|
|
13
|
-
]);
|
|
14
|
-
const NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP = /* @__PURE__ */ new Map([
|
|
15
|
-
[Float32Array, "float32"],
|
|
16
|
-
[Uint8Array, "uint8"],
|
|
17
|
-
[Int8Array, "int8"],
|
|
18
|
-
[Uint16Array, "uint16"],
|
|
19
|
-
[Int16Array, "int16"],
|
|
20
|
-
[Int32Array, "int32"],
|
|
21
|
-
[Float64Array, "float64"],
|
|
22
|
-
[Uint32Array, "uint32"]
|
|
23
|
-
]);
|
|
24
|
-
if (isBigInt64ArrayAvailable) {
|
|
25
|
-
NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("int64", BigInt64Array);
|
|
26
|
-
NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigInt64Array, "int64");
|
|
27
|
-
}
|
|
28
|
-
if (isBigUint64ArrayAvailable) {
|
|
29
|
-
NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("uint64", BigUint64Array);
|
|
30
|
-
NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigUint64Array, "uint64");
|
|
31
|
-
}
|
|
32
|
-
const calculateSize = (dims) => {
|
|
33
|
-
let size = 1;
|
|
34
|
-
for (let i = 0; i < dims.length; i++) {
|
|
35
|
-
const dim = dims[i];
|
|
36
|
-
if (typeof dim !== "number" || !Number.isSafeInteger(dim)) {
|
|
37
|
-
throw new TypeError(`dims[${i}] must be an integer, got: ${dim}`);
|
|
38
|
-
}
|
|
39
|
-
if (dim < 0) {
|
|
40
|
-
throw new RangeError(`dims[${i}] must be a non-negative integer, got: ${dim}`);
|
|
41
|
-
}
|
|
42
|
-
size *= dim;
|
|
43
|
-
}
|
|
44
|
-
return size;
|
|
45
|
-
};
|
|
46
|
-
class Tensor {
|
|
47
|
-
constructor(arg0, arg1, arg2) {
|
|
48
|
-
let type;
|
|
49
|
-
let data;
|
|
50
|
-
let dims;
|
|
51
|
-
if (typeof arg0 === "string") {
|
|
52
|
-
type = arg0;
|
|
53
|
-
dims = arg2;
|
|
54
|
-
if (arg0 === "string") {
|
|
55
|
-
if (!Array.isArray(arg1)) {
|
|
56
|
-
throw new TypeError("A string tensor's data must be a string array.");
|
|
57
|
-
}
|
|
58
|
-
data = arg1;
|
|
59
|
-
} else {
|
|
60
|
-
const typedArrayConstructor = NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.get(arg0);
|
|
61
|
-
if (typedArrayConstructor === void 0) {
|
|
62
|
-
throw new TypeError(`Unsupported tensor type: ${arg0}.`);
|
|
63
|
-
}
|
|
64
|
-
if (Array.isArray(arg1)) {
|
|
65
|
-
data = typedArrayConstructor.from(arg1);
|
|
66
|
-
} else if (arg1 instanceof typedArrayConstructor) {
|
|
67
|
-
data = arg1;
|
|
68
|
-
} else {
|
|
69
|
-
throw new TypeError(`A ${type} tensor's data must be type of ${typedArrayConstructor}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
dims = arg1;
|
|
74
|
-
if (Array.isArray(arg0)) {
|
|
75
|
-
if (arg0.length === 0) {
|
|
76
|
-
throw new TypeError("Tensor type cannot be inferred from an empty array.");
|
|
77
|
-
}
|
|
78
|
-
const firstElementType = typeof arg0[0];
|
|
79
|
-
if (firstElementType === "string") {
|
|
80
|
-
type = "string";
|
|
81
|
-
data = arg0;
|
|
82
|
-
} else if (firstElementType === "boolean") {
|
|
83
|
-
type = "bool";
|
|
84
|
-
data = Uint8Array.from(arg0);
|
|
85
|
-
} else {
|
|
86
|
-
throw new TypeError(`Invalid element type of data array: ${firstElementType}.`);
|
|
87
|
-
}
|
|
88
|
-
} else {
|
|
89
|
-
const mappedType = NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.get(arg0.constructor);
|
|
90
|
-
if (mappedType === void 0) {
|
|
91
|
-
throw new TypeError(`Unsupported type for tensor data: ${arg0.constructor}.`);
|
|
92
|
-
}
|
|
93
|
-
type = mappedType;
|
|
94
|
-
data = arg0;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (dims === void 0) {
|
|
98
|
-
dims = [data.length];
|
|
99
|
-
} else if (!Array.isArray(dims)) {
|
|
100
|
-
throw new TypeError("A tensor's dims must be a number array");
|
|
101
|
-
}
|
|
102
|
-
const size = calculateSize(dims);
|
|
103
|
-
if (size !== data.length) {
|
|
104
|
-
throw new Error(`Tensor's size(${size}) does not match data length(${data.length}).`);
|
|
105
|
-
}
|
|
106
|
-
this.dims = dims;
|
|
107
|
-
this.type = type;
|
|
108
|
-
this.data = data;
|
|
109
|
-
this.size = size;
|
|
110
|
-
}
|
|
111
|
-
// #endregion
|
|
112
|
-
/**
|
|
113
|
-
* Create a new tensor object from image object
|
|
114
|
-
*
|
|
115
|
-
* @param buffer - Extracted image buffer data - assuming RGBA format
|
|
116
|
-
* @param imageFormat - input image configuration - required configurations height, width, format
|
|
117
|
-
* @param tensorFormat - output tensor configuration - Default is RGB format
|
|
118
|
-
*/
|
|
119
|
-
static bufferToTensor(buffer, options) {
|
|
120
|
-
if (buffer === void 0) {
|
|
121
|
-
throw new Error("Image buffer must be defined");
|
|
122
|
-
}
|
|
123
|
-
if (options.height === void 0 || options.width === void 0) {
|
|
124
|
-
throw new Error("Image height and width must be defined");
|
|
125
|
-
}
|
|
126
|
-
const { height, width } = options;
|
|
127
|
-
const norm = options.norm;
|
|
128
|
-
let normMean;
|
|
129
|
-
let normBias;
|
|
130
|
-
if (norm === void 0 || norm.mean === void 0) {
|
|
131
|
-
normMean = 255;
|
|
132
|
-
} else {
|
|
133
|
-
normMean = norm.mean;
|
|
134
|
-
}
|
|
135
|
-
if (norm === void 0 || norm.bias === void 0) {
|
|
136
|
-
normBias = 0;
|
|
137
|
-
} else {
|
|
138
|
-
normBias = norm.bias;
|
|
139
|
-
}
|
|
140
|
-
const inputformat = options.bitmapFormat !== void 0 ? options.bitmapFormat : "RGBA";
|
|
141
|
-
const outputformat = options.tensorFormat !== void 0 ? options.tensorFormat !== void 0 ? options.tensorFormat : "RGB" : "RGB";
|
|
142
|
-
const offset = height * width;
|
|
143
|
-
const float32Data = outputformat === "RGBA" ? new Float32Array(offset * 4) : new Float32Array(offset * 3);
|
|
144
|
-
let step = 4, rImagePointer = 0, gImagePointer = 1, bImagePointer = 2, aImagePointer = 3;
|
|
145
|
-
let rTensorPointer = 0, gTensorPointer = offset, bTensorPointer = offset * 2, aTensorPointer = -1;
|
|
146
|
-
if (inputformat === "RGB") {
|
|
147
|
-
step = 3;
|
|
148
|
-
rImagePointer = 0;
|
|
149
|
-
gImagePointer = 1;
|
|
150
|
-
bImagePointer = 2;
|
|
151
|
-
aImagePointer = -1;
|
|
152
|
-
}
|
|
153
|
-
if (outputformat === "RGBA") {
|
|
154
|
-
aTensorPointer = offset * 3;
|
|
155
|
-
} else if (outputformat === "RBG") {
|
|
156
|
-
rTensorPointer = 0;
|
|
157
|
-
bTensorPointer = offset;
|
|
158
|
-
gTensorPointer = offset * 2;
|
|
159
|
-
} else if (outputformat === "BGR") {
|
|
160
|
-
bTensorPointer = 0;
|
|
161
|
-
gTensorPointer = offset;
|
|
162
|
-
rTensorPointer = offset * 2;
|
|
163
|
-
}
|
|
164
|
-
for (let i = 0; i < offset; i++, rImagePointer += step, bImagePointer += step, gImagePointer += step, aImagePointer += step) {
|
|
165
|
-
float32Data[rTensorPointer++] = (buffer[rImagePointer] + normBias) / normMean;
|
|
166
|
-
float32Data[gTensorPointer++] = (buffer[gImagePointer] + normBias) / normMean;
|
|
167
|
-
float32Data[bTensorPointer++] = (buffer[bImagePointer] + normBias) / normMean;
|
|
168
|
-
if (aTensorPointer !== -1 && aImagePointer !== -1) {
|
|
169
|
-
float32Data[aTensorPointer++] = (buffer[aImagePointer] + normBias) / normMean;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
const outputTensor = outputformat === "RGBA" ? new Tensor("float32", float32Data, [1, 4, height, width]) : new Tensor("float32", float32Data, [1, 3, height, width]);
|
|
173
|
-
return outputTensor;
|
|
174
|
-
}
|
|
175
|
-
static async fromImage(image, options) {
|
|
176
|
-
const isHTMLImageEle = typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement;
|
|
177
|
-
const isImageDataEle = typeof ImageData !== "undefined" && image instanceof ImageData;
|
|
178
|
-
const isImageBitmap = typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap;
|
|
179
|
-
const isURL = typeof String !== "undefined" && (image instanceof String || typeof image === "string");
|
|
180
|
-
let data;
|
|
181
|
-
let tensorConfig = {};
|
|
182
|
-
if (isHTMLImageEle) {
|
|
183
|
-
const canvas = document.createElement("canvas");
|
|
184
|
-
const pixels2DContext = canvas.getContext("2d");
|
|
185
|
-
if (pixels2DContext != null) {
|
|
186
|
-
let height = image.naturalHeight;
|
|
187
|
-
let width = image.naturalWidth;
|
|
188
|
-
if (options !== void 0 && options.resizedHeight !== void 0 && options.resizedWidth !== void 0) {
|
|
189
|
-
height = options.resizedHeight;
|
|
190
|
-
width = options.resizedWidth;
|
|
191
|
-
}
|
|
192
|
-
if (options !== void 0) {
|
|
193
|
-
tensorConfig = options;
|
|
194
|
-
if (options.tensorFormat !== void 0) {
|
|
195
|
-
throw new Error("Image input config format must be RGBA for HTMLImageElement");
|
|
196
|
-
} else {
|
|
197
|
-
tensorConfig.tensorFormat = "RGBA";
|
|
198
|
-
}
|
|
199
|
-
if (options.height !== void 0 && options.height !== height) {
|
|
200
|
-
throw new Error("Image input config height doesn't match HTMLImageElement height");
|
|
201
|
-
} else {
|
|
202
|
-
tensorConfig.height = height;
|
|
203
|
-
}
|
|
204
|
-
if (options.width !== void 0 && options.width !== width) {
|
|
205
|
-
throw new Error("Image input config width doesn't match HTMLImageElement width");
|
|
206
|
-
} else {
|
|
207
|
-
tensorConfig.width = width;
|
|
208
|
-
}
|
|
209
|
-
} else {
|
|
210
|
-
tensorConfig.tensorFormat = "RGBA";
|
|
211
|
-
tensorConfig.height = height;
|
|
212
|
-
tensorConfig.width = width;
|
|
213
|
-
}
|
|
214
|
-
canvas.width = width;
|
|
215
|
-
canvas.height = height;
|
|
216
|
-
pixels2DContext.drawImage(image, 0, 0, width, height);
|
|
217
|
-
data = pixels2DContext.getImageData(0, 0, width, height).data;
|
|
218
|
-
} else {
|
|
219
|
-
throw new Error("Can not access image data");
|
|
220
|
-
}
|
|
221
|
-
} else if (isImageDataEle) {
|
|
222
|
-
const format = "RGBA";
|
|
223
|
-
let height;
|
|
224
|
-
let width;
|
|
225
|
-
if (options !== void 0 && options.resizedWidth !== void 0 && options.resizedHeight !== void 0) {
|
|
226
|
-
height = options.resizedHeight;
|
|
227
|
-
width = options.resizedWidth;
|
|
228
|
-
} else {
|
|
229
|
-
height = image.height;
|
|
230
|
-
width = image.width;
|
|
231
|
-
}
|
|
232
|
-
if (options !== void 0) {
|
|
233
|
-
tensorConfig = options;
|
|
234
|
-
if (options.bitmapFormat !== void 0 && options.bitmapFormat !== format) {
|
|
235
|
-
throw new Error("Image input config format must be RGBA for ImageData");
|
|
236
|
-
} else {
|
|
237
|
-
tensorConfig.bitmapFormat = "RGBA";
|
|
238
|
-
}
|
|
239
|
-
} else {
|
|
240
|
-
tensorConfig.bitmapFormat = "RGBA";
|
|
241
|
-
}
|
|
242
|
-
tensorConfig.height = height;
|
|
243
|
-
tensorConfig.width = width;
|
|
244
|
-
if (options !== void 0) {
|
|
245
|
-
const tempCanvas = document.createElement("canvas");
|
|
246
|
-
tempCanvas.width = width;
|
|
247
|
-
tempCanvas.height = height;
|
|
248
|
-
const pixels2DContext = tempCanvas.getContext("2d");
|
|
249
|
-
if (pixels2DContext != null) {
|
|
250
|
-
pixels2DContext.putImageData(image, 0, 0);
|
|
251
|
-
data = pixels2DContext.getImageData(0, 0, width, height).data;
|
|
252
|
-
} else {
|
|
253
|
-
throw new Error("Can not access image data");
|
|
254
|
-
}
|
|
255
|
-
} else {
|
|
256
|
-
data = image.data;
|
|
257
|
-
}
|
|
258
|
-
} else if (isImageBitmap) {
|
|
259
|
-
if (options === void 0) {
|
|
260
|
-
throw new Error("Please provide image config with format for Imagebitmap");
|
|
261
|
-
}
|
|
262
|
-
if (options.bitmapFormat !== void 0) {
|
|
263
|
-
throw new Error("Image input config format must be defined for ImageBitmap");
|
|
264
|
-
}
|
|
265
|
-
const pixels2DContext = document.createElement("canvas").getContext("2d");
|
|
266
|
-
if (pixels2DContext != null) {
|
|
267
|
-
const height = image.height;
|
|
268
|
-
const width = image.width;
|
|
269
|
-
pixels2DContext.drawImage(image, 0, 0, width, height);
|
|
270
|
-
data = pixels2DContext.getImageData(0, 0, width, height).data;
|
|
271
|
-
if (options !== void 0) {
|
|
272
|
-
if (options.height !== void 0 && options.height !== height) {
|
|
273
|
-
throw new Error("Image input config height doesn't match ImageBitmap height");
|
|
274
|
-
} else {
|
|
275
|
-
tensorConfig.height = height;
|
|
276
|
-
}
|
|
277
|
-
if (options.width !== void 0 && options.width !== width) {
|
|
278
|
-
throw new Error("Image input config width doesn't match ImageBitmap width");
|
|
279
|
-
} else {
|
|
280
|
-
tensorConfig.width = width;
|
|
281
|
-
}
|
|
282
|
-
} else {
|
|
283
|
-
tensorConfig.height = height;
|
|
284
|
-
tensorConfig.width = width;
|
|
285
|
-
}
|
|
286
|
-
return Tensor.bufferToTensor(data, tensorConfig);
|
|
287
|
-
} else {
|
|
288
|
-
throw new Error("Can not access image data");
|
|
289
|
-
}
|
|
290
|
-
} else if (isURL) {
|
|
291
|
-
return new Promise((resolve, reject) => {
|
|
292
|
-
const canvas = document.createElement("canvas");
|
|
293
|
-
const context = canvas.getContext("2d");
|
|
294
|
-
if (!image || !context) {
|
|
295
|
-
return reject();
|
|
296
|
-
}
|
|
297
|
-
const newImage = new Image();
|
|
298
|
-
newImage.crossOrigin = "Anonymous";
|
|
299
|
-
newImage.src = image;
|
|
300
|
-
newImage.onload = () => {
|
|
301
|
-
canvas.width = newImage.width;
|
|
302
|
-
canvas.height = newImage.height;
|
|
303
|
-
context.drawImage(newImage, 0, 0, canvas.width, canvas.height);
|
|
304
|
-
const img = context.getImageData(0, 0, canvas.width, canvas.height);
|
|
305
|
-
if (options !== void 0) {
|
|
306
|
-
if (options.height !== void 0 && options.height !== canvas.height) {
|
|
307
|
-
throw new Error("Image input config height doesn't match ImageBitmap height");
|
|
308
|
-
} else {
|
|
309
|
-
tensorConfig.height = canvas.height;
|
|
310
|
-
}
|
|
311
|
-
if (options.width !== void 0 && options.width !== canvas.width) {
|
|
312
|
-
throw new Error("Image input config width doesn't match ImageBitmap width");
|
|
313
|
-
} else {
|
|
314
|
-
tensorConfig.width = canvas.width;
|
|
315
|
-
}
|
|
316
|
-
} else {
|
|
317
|
-
tensorConfig.height = canvas.height;
|
|
318
|
-
tensorConfig.width = canvas.width;
|
|
319
|
-
}
|
|
320
|
-
resolve(Tensor.bufferToTensor(img.data, tensorConfig));
|
|
321
|
-
};
|
|
322
|
-
});
|
|
323
|
-
} else {
|
|
324
|
-
throw new Error("Input data provided is not supported - aborted tensor creation");
|
|
325
|
-
}
|
|
326
|
-
if (data !== void 0) {
|
|
327
|
-
return Tensor.bufferToTensor(data, tensorConfig);
|
|
328
|
-
} else {
|
|
329
|
-
throw new Error("Input data provided is not supported - aborted tensor creation");
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
toImageData(options) {
|
|
333
|
-
var _a, _b;
|
|
334
|
-
const pixels2DContext = document.createElement("canvas").getContext("2d");
|
|
335
|
-
let image;
|
|
336
|
-
if (pixels2DContext != null) {
|
|
337
|
-
const width = this.dims[3];
|
|
338
|
-
const height = this.dims[2];
|
|
339
|
-
const channels = this.dims[1];
|
|
340
|
-
const inputformat = options !== void 0 ? options.format !== void 0 ? options.format : "RGB" : "RGB";
|
|
341
|
-
const normMean = options !== void 0 ? ((_a = options.norm) === null || _a === void 0 ? void 0 : _a.mean) !== void 0 ? options.norm.mean : 255 : 255;
|
|
342
|
-
const normBias = options !== void 0 ? ((_b = options.norm) === null || _b === void 0 ? void 0 : _b.bias) !== void 0 ? options.norm.bias : 0 : 0;
|
|
343
|
-
const offset = height * width;
|
|
344
|
-
if (options !== void 0) {
|
|
345
|
-
if (options.height !== void 0 && options.height !== height) {
|
|
346
|
-
throw new Error("Image output config height doesn't match tensor height");
|
|
347
|
-
}
|
|
348
|
-
if (options.width !== void 0 && options.width !== width) {
|
|
349
|
-
throw new Error("Image output config width doesn't match tensor width");
|
|
350
|
-
}
|
|
351
|
-
if (options.format !== void 0 && (channels === 4 && options.format !== "RGBA") || channels === 3 && (options.format !== "RGB" && options.format !== "BGR")) {
|
|
352
|
-
throw new Error("Tensor format doesn't match input tensor dims");
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
const step = 4;
|
|
356
|
-
let rImagePointer = 0, gImagePointer = 1, bImagePointer = 2, aImagePointer = 3;
|
|
357
|
-
let rTensorPointer = 0, gTensorPointer = offset, bTensorPointer = offset * 2, aTensorPointer = -1;
|
|
358
|
-
if (inputformat === "RGBA") {
|
|
359
|
-
rTensorPointer = 0;
|
|
360
|
-
gTensorPointer = offset;
|
|
361
|
-
bTensorPointer = offset * 2;
|
|
362
|
-
aTensorPointer = offset * 3;
|
|
363
|
-
} else if (inputformat === "RGB") {
|
|
364
|
-
rTensorPointer = 0;
|
|
365
|
-
gTensorPointer = offset;
|
|
366
|
-
bTensorPointer = offset * 2;
|
|
367
|
-
} else if (inputformat === "RBG") {
|
|
368
|
-
rTensorPointer = 0;
|
|
369
|
-
bTensorPointer = offset;
|
|
370
|
-
gTensorPointer = offset * 2;
|
|
371
|
-
}
|
|
372
|
-
image = pixels2DContext.createImageData(width, height);
|
|
373
|
-
for (let i = 0; i < height * width; rImagePointer += step, gImagePointer += step, bImagePointer += step, aImagePointer += step, i++) {
|
|
374
|
-
image.data[rImagePointer] = (this.data[rTensorPointer++] - normBias) * normMean;
|
|
375
|
-
image.data[gImagePointer] = (this.data[gTensorPointer++] - normBias) * normMean;
|
|
376
|
-
image.data[bImagePointer] = (this.data[bTensorPointer++] - normBias) * normMean;
|
|
377
|
-
image.data[aImagePointer] = aTensorPointer === -1 ? 255 : (this.data[aTensorPointer++] - normBias) * normMean;
|
|
378
|
-
}
|
|
379
|
-
} else {
|
|
380
|
-
throw new Error("Can not access image data");
|
|
381
|
-
}
|
|
382
|
-
return image;
|
|
383
|
-
}
|
|
384
|
-
// #endregion
|
|
385
|
-
// #region tensor utilities
|
|
386
|
-
reshape(dims) {
|
|
387
|
-
return new Tensor(this.type, this.data, dims);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
export {
|
|
391
|
-
Tensor
|
|
392
|
-
};
|
|
393
|
-
//# sourceMappingURL=tensor-impl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tensor-impl.js","sources":["../../../../../node_modules/onnxruntime-common/dist/lib/tensor-impl.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\nconst isBigInt64ArrayAvailable = typeof BigInt64Array !== 'undefined' && typeof BigInt64Array.from === 'function';\nconst isBigUint64ArrayAvailable = typeof BigUint64Array !== 'undefined' && typeof BigUint64Array.from === 'function';\n// a runtime map that maps type string to TypedArray constructor. Should match Tensor.DataTypeMap.\nconst NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP = new Map([\n ['float32', Float32Array],\n ['uint8', Uint8Array],\n ['int8', Int8Array],\n ['uint16', Uint16Array],\n ['int16', Int16Array],\n ['int32', Int32Array],\n ['bool', Uint8Array],\n ['float64', Float64Array],\n ['uint32', Uint32Array],\n]);\n// a runtime map that maps type string to TypedArray constructor. Should match Tensor.DataTypeMap.\nconst NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP = new Map([\n [Float32Array, 'float32'],\n [Uint8Array, 'uint8'],\n [Int8Array, 'int8'],\n [Uint16Array, 'uint16'],\n [Int16Array, 'int16'],\n [Int32Array, 'int32'],\n [Float64Array, 'float64'],\n [Uint32Array, 'uint32'],\n]);\nif (isBigInt64ArrayAvailable) {\n NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set('int64', BigInt64Array);\n NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigInt64Array, 'int64');\n}\nif (isBigUint64ArrayAvailable) {\n NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set('uint64', BigUint64Array);\n NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigUint64Array, 'uint64');\n}\n/**\n * calculate size from dims.\n *\n * @param dims the dims array. May be an illegal input.\n */\nconst calculateSize = (dims) => {\n let size = 1;\n for (let i = 0; i < dims.length; i++) {\n const dim = dims[i];\n if (typeof dim !== 'number' || !Number.isSafeInteger(dim)) {\n throw new TypeError(`dims[${i}] must be an integer, got: ${dim}`);\n }\n if (dim < 0) {\n throw new RangeError(`dims[${i}] must be a non-negative integer, got: ${dim}`);\n }\n size *= dim;\n }\n return size;\n};\nexport class Tensor {\n constructor(arg0, arg1, arg2) {\n let type;\n let data;\n let dims;\n // check whether arg0 is type or data\n if (typeof arg0 === 'string') {\n //\n // Override: constructor(type, data, ...)\n //\n type = arg0;\n dims = arg2;\n if (arg0 === 'string') {\n // string tensor\n if (!Array.isArray(arg1)) {\n throw new TypeError('A string tensor\\'s data must be a string array.');\n }\n // we don't check whether every element in the array is string; this is too slow. we assume it's correct and\n // error will be populated at inference\n data = arg1;\n }\n else {\n // numeric tensor\n const typedArrayConstructor = NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.get(arg0);\n if (typedArrayConstructor === undefined) {\n throw new TypeError(`Unsupported tensor type: ${arg0}.`);\n }\n if (Array.isArray(arg1)) {\n // use 'as any' here because TypeScript's check on type of 'SupportedTypedArrayConstructors.from()' produces\n // incorrect results.\n // 'typedArrayConstructor' should be one of the typed array prototype objects.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data = typedArrayConstructor.from(arg1);\n }\n else if (arg1 instanceof typedArrayConstructor) {\n data = arg1;\n }\n else {\n throw new TypeError(`A ${type} tensor's data must be type of ${typedArrayConstructor}`);\n }\n }\n }\n else {\n //\n // Override: constructor(data, ...)\n //\n dims = arg1;\n if (Array.isArray(arg0)) {\n // only boolean[] and string[] is supported\n if (arg0.length === 0) {\n throw new TypeError('Tensor type cannot be inferred from an empty array.');\n }\n const firstElementType = typeof arg0[0];\n if (firstElementType === 'string') {\n type = 'string';\n data = arg0;\n }\n else if (firstElementType === 'boolean') {\n type = 'bool';\n // 'arg0' is of type 'boolean[]'. Uint8Array.from(boolean[]) actually works, but typescript thinks this is\n // wrong type. We use 'as any' to make it happy.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data = Uint8Array.from(arg0);\n }\n else {\n throw new TypeError(`Invalid element type of data array: ${firstElementType}.`);\n }\n }\n else {\n // get tensor type from TypedArray\n const mappedType = NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.get(arg0.constructor);\n if (mappedType === undefined) {\n throw new TypeError(`Unsupported type for tensor data: ${arg0.constructor}.`);\n }\n type = mappedType;\n data = arg0;\n }\n }\n // type and data is processed, now processing dims\n if (dims === undefined) {\n // assume 1-D tensor if dims omitted\n dims = [data.length];\n }\n else if (!Array.isArray(dims)) {\n throw new TypeError('A tensor\\'s dims must be a number array');\n }\n // perform check\n const size = calculateSize(dims);\n if (size !== data.length) {\n throw new Error(`Tensor's size(${size}) does not match data length(${data.length}).`);\n }\n this.dims = dims;\n this.type = type;\n this.data = data;\n this.size = size;\n }\n // #endregion\n /**\n * Create a new tensor object from image object\n *\n * @param buffer - Extracted image buffer data - assuming RGBA format\n * @param imageFormat - input image configuration - required configurations height, width, format\n * @param tensorFormat - output tensor configuration - Default is RGB format\n */\n static bufferToTensor(buffer, options) {\n if (buffer === undefined) {\n throw new Error('Image buffer must be defined');\n }\n if (options.height === undefined || options.width === undefined) {\n throw new Error('Image height and width must be defined');\n }\n const { height, width } = options;\n const norm = options.norm;\n let normMean;\n let normBias;\n if (norm === undefined || norm.mean === undefined) {\n normMean = 255;\n }\n else {\n normMean = norm.mean;\n }\n if (norm === undefined || norm.bias === undefined) {\n normBias = 0;\n }\n else {\n normBias = norm.bias;\n }\n const inputformat = options.bitmapFormat !== undefined ? options.bitmapFormat : 'RGBA';\n // default value is RGBA since imagedata and HTMLImageElement uses it\n const outputformat = options.tensorFormat !== undefined ?\n (options.tensorFormat !== undefined ? options.tensorFormat : 'RGB') :\n 'RGB';\n const offset = height * width;\n const float32Data = outputformat === 'RGBA' ? new Float32Array(offset * 4) : new Float32Array(offset * 3);\n // Default pointer assignments\n let step = 4, rImagePointer = 0, gImagePointer = 1, bImagePointer = 2, aImagePointer = 3;\n let rTensorPointer = 0, gTensorPointer = offset, bTensorPointer = offset * 2, aTensorPointer = -1;\n // Updating the pointer assignments based on the input image format\n if (inputformat === 'RGB') {\n step = 3;\n rImagePointer = 0;\n gImagePointer = 1;\n bImagePointer = 2;\n aImagePointer = -1;\n }\n // Updating the pointer assignments based on the output tensor format\n if (outputformat === 'RGBA') {\n aTensorPointer = offset * 3;\n }\n else if (outputformat === 'RBG') {\n rTensorPointer = 0;\n bTensorPointer = offset;\n gTensorPointer = offset * 2;\n }\n else if (outputformat === 'BGR') {\n bTensorPointer = 0;\n gTensorPointer = offset;\n rTensorPointer = offset * 2;\n }\n for (let i = 0; i < offset; i++, rImagePointer += step, bImagePointer += step, gImagePointer += step, aImagePointer += step) {\n float32Data[rTensorPointer++] = (buffer[rImagePointer] + normBias) / normMean;\n float32Data[gTensorPointer++] = (buffer[gImagePointer] + normBias) / normMean;\n float32Data[bTensorPointer++] = (buffer[bImagePointer] + normBias) / normMean;\n if (aTensorPointer !== -1 && aImagePointer !== -1) {\n float32Data[aTensorPointer++] = (buffer[aImagePointer] + normBias) / normMean;\n }\n }\n // Float32Array -> ort.Tensor\n const outputTensor = outputformat === 'RGBA' ? new Tensor('float32', float32Data, [1, 4, height, width]) :\n new Tensor('float32', float32Data, [1, 3, height, width]);\n return outputTensor;\n }\n static async fromImage(image, options) {\n // checking the type of image object\n const isHTMLImageEle = typeof (HTMLImageElement) !== 'undefined' && image instanceof HTMLImageElement;\n const isImageDataEle = typeof (ImageData) !== 'undefined' && image instanceof ImageData;\n const isImageBitmap = typeof (ImageBitmap) !== 'undefined' && image instanceof ImageBitmap;\n const isURL = typeof (String) !== 'undefined' && (image instanceof String || typeof image === 'string');\n let data;\n let tensorConfig = {};\n // filling and checking image configuration options\n if (isHTMLImageEle) {\n // HTMLImageElement - image object - format is RGBA by default\n const canvas = document.createElement('canvas');\n const pixels2DContext = canvas.getContext('2d');\n if (pixels2DContext != null) {\n let height = image.naturalHeight;\n let width = image.naturalWidth;\n if (options !== undefined && options.resizedHeight !== undefined && options.resizedWidth !== undefined) {\n height = options.resizedHeight;\n width = options.resizedWidth;\n }\n if (options !== undefined) {\n tensorConfig = options;\n if (options.tensorFormat !== undefined) {\n throw new Error('Image input config format must be RGBA for HTMLImageElement');\n }\n else {\n tensorConfig.tensorFormat = 'RGBA';\n }\n if (options.height !== undefined && options.height !== height) {\n throw new Error('Image input config height doesn\\'t match HTMLImageElement height');\n }\n else {\n tensorConfig.height = height;\n }\n if (options.width !== undefined && options.width !== width) {\n throw new Error('Image input config width doesn\\'t match HTMLImageElement width');\n }\n else {\n tensorConfig.width = width;\n }\n }\n else {\n tensorConfig.tensorFormat = 'RGBA';\n tensorConfig.height = height;\n tensorConfig.width = width;\n }\n canvas.width = width;\n canvas.height = height;\n pixels2DContext.drawImage(image, 0, 0, width, height);\n data = pixels2DContext.getImageData(0, 0, width, height).data;\n }\n else {\n throw new Error('Can not access image data');\n }\n }\n else if (isImageDataEle) {\n // ImageData - image object - format is RGBA by default\n const format = 'RGBA';\n let height;\n let width;\n if (options !== undefined && options.resizedWidth !== undefined && options.resizedHeight !== undefined) {\n height = options.resizedHeight;\n width = options.resizedWidth;\n }\n else {\n height = image.height;\n width = image.width;\n }\n if (options !== undefined) {\n tensorConfig = options;\n if (options.bitmapFormat !== undefined && options.bitmapFormat !== format) {\n throw new Error('Image input config format must be RGBA for ImageData');\n }\n else {\n tensorConfig.bitmapFormat = 'RGBA';\n }\n }\n else {\n tensorConfig.bitmapFormat = 'RGBA';\n }\n tensorConfig.height = height;\n tensorConfig.width = width;\n if (options !== undefined) {\n const tempCanvas = document.createElement('canvas');\n tempCanvas.width = width;\n tempCanvas.height = height;\n const pixels2DContext = tempCanvas.getContext('2d');\n if (pixels2DContext != null) {\n pixels2DContext.putImageData(image, 0, 0);\n data = pixels2DContext.getImageData(0, 0, width, height).data;\n }\n else {\n throw new Error('Can not access image data');\n }\n }\n else {\n data = image.data;\n }\n }\n else if (isImageBitmap) {\n // ImageBitmap - image object - format must be provided by user\n if (options === undefined) {\n throw new Error('Please provide image config with format for Imagebitmap');\n }\n if (options.bitmapFormat !== undefined) {\n throw new Error('Image input config format must be defined for ImageBitmap');\n }\n const pixels2DContext = document.createElement('canvas').getContext('2d');\n if (pixels2DContext != null) {\n const height = image.height;\n const width = image.width;\n pixels2DContext.drawImage(image, 0, 0, width, height);\n data = pixels2DContext.getImageData(0, 0, width, height).data;\n if (options !== undefined) {\n // using square brackets to avoid TS error - type 'never'\n if (options.height !== undefined && options.height !== height) {\n throw new Error('Image input config height doesn\\'t match ImageBitmap height');\n }\n else {\n tensorConfig.height = height;\n }\n // using square brackets to avoid TS error - type 'never'\n if (options.width !== undefined && options.width !== width) {\n throw new Error('Image input config width doesn\\'t match ImageBitmap width');\n }\n else {\n tensorConfig.width = width;\n }\n }\n else {\n tensorConfig.height = height;\n tensorConfig.width = width;\n }\n return Tensor.bufferToTensor(data, tensorConfig);\n }\n else {\n throw new Error('Can not access image data');\n }\n }\n else if (isURL) {\n return new Promise((resolve, reject) => {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (!image || !context) {\n return reject();\n }\n const newImage = new Image();\n newImage.crossOrigin = 'Anonymous';\n newImage.src = image;\n newImage.onload = () => {\n canvas.width = newImage.width;\n canvas.height = newImage.height;\n context.drawImage(newImage, 0, 0, canvas.width, canvas.height);\n const img = context.getImageData(0, 0, canvas.width, canvas.height);\n if (options !== undefined) {\n // using square brackets to avoid TS error - type 'never'\n if (options.height !== undefined && options.height !== canvas.height) {\n throw new Error('Image input config height doesn\\'t match ImageBitmap height');\n }\n else {\n tensorConfig.height = canvas.height;\n }\n // using square brackets to avoid TS error - type 'never'\n if (options.width !== undefined && options.width !== canvas.width) {\n throw new Error('Image input config width doesn\\'t match ImageBitmap width');\n }\n else {\n tensorConfig.width = canvas.width;\n }\n }\n else {\n tensorConfig.height = canvas.height;\n tensorConfig.width = canvas.width;\n }\n resolve(Tensor.bufferToTensor(img.data, tensorConfig));\n };\n });\n }\n else {\n throw new Error('Input data provided is not supported - aborted tensor creation');\n }\n if (data !== undefined) {\n return Tensor.bufferToTensor(data, tensorConfig);\n }\n else {\n throw new Error('Input data provided is not supported - aborted tensor creation');\n }\n }\n toImageData(options) {\n var _a, _b;\n const pixels2DContext = document.createElement('canvas').getContext('2d');\n let image;\n if (pixels2DContext != null) {\n // Default values for height and width & format\n const width = this.dims[3];\n const height = this.dims[2];\n const channels = this.dims[1];\n const inputformat = options !== undefined ? (options.format !== undefined ? options.format : 'RGB') : 'RGB';\n const normMean = options !== undefined ? (((_a = options.norm) === null || _a === void 0 ? void 0 : _a.mean) !== undefined ? options.norm.mean : 255) : 255;\n const normBias = options !== undefined ? (((_b = options.norm) === null || _b === void 0 ? void 0 : _b.bias) !== undefined ? options.norm.bias : 0) : 0;\n const offset = height * width;\n if (options !== undefined) {\n if (options.height !== undefined && options.height !== height) {\n throw new Error('Image output config height doesn\\'t match tensor height');\n }\n if (options.width !== undefined && options.width !== width) {\n throw new Error('Image output config width doesn\\'t match tensor width');\n }\n if (options.format !== undefined && (channels === 4 && options.format !== 'RGBA') ||\n (channels === 3 && (options.format !== 'RGB' && options.format !== 'BGR'))) {\n throw new Error('Tensor format doesn\\'t match input tensor dims');\n }\n }\n // Default pointer assignments\n const step = 4;\n let rImagePointer = 0, gImagePointer = 1, bImagePointer = 2, aImagePointer = 3;\n let rTensorPointer = 0, gTensorPointer = offset, bTensorPointer = offset * 2, aTensorPointer = -1;\n // Updating the pointer assignments based on the input image format\n if (inputformat === 'RGBA') {\n rTensorPointer = 0;\n gTensorPointer = offset;\n bTensorPointer = offset * 2;\n aTensorPointer = offset * 3;\n }\n else if (inputformat === 'RGB') {\n rTensorPointer = 0;\n gTensorPointer = offset;\n bTensorPointer = offset * 2;\n }\n else if (inputformat === 'RBG') {\n rTensorPointer = 0;\n bTensorPointer = offset;\n gTensorPointer = offset * 2;\n }\n image = pixels2DContext.createImageData(width, height);\n for (let i = 0; i < height * width; rImagePointer += step, gImagePointer += step, bImagePointer += step, aImagePointer += step, i++) {\n image.data[rImagePointer] = (this.data[rTensorPointer++] - normBias) * normMean; // R value\n image.data[gImagePointer] = (this.data[gTensorPointer++] - normBias) * normMean; // G value\n image.data[bImagePointer] = (this.data[bTensorPointer++] - normBias) * normMean; // B value\n image.data[aImagePointer] =\n aTensorPointer === -1 ? 255 : (this.data[aTensorPointer++] - normBias) * normMean; // A value\n }\n }\n else {\n throw new Error('Can not access image data');\n }\n return image;\n }\n // #endregion\n // #region tensor utilities\n reshape(dims) {\n return new Tensor(this.type, this.data, dims);\n }\n}\n//# sourceMappingURL=tensor-impl.js.map"],"names":[],"mappings":"AAEA,MAAM,2BAA2B,OAAO,kBAAkB,eAAe,OAAO,cAAc,SAAS;AACvG,MAAM,4BAA4B,OAAO,mBAAmB,eAAe,OAAO,eAAe,SAAS;AAE1G,MAAM,wCAAwC,oBAAI,IAAI;AAAA,EAClD,CAAC,WAAW,YAAY;AAAA,EACxB,CAAC,SAAS,UAAU;AAAA,EACpB,CAAC,QAAQ,SAAS;AAAA,EAClB,CAAC,UAAU,WAAW;AAAA,EACtB,CAAC,SAAS,UAAU;AAAA,EACpB,CAAC,SAAS,UAAU;AAAA,EACpB,CAAC,QAAQ,UAAU;AAAA,E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,gBAAgB,OAAO;AAC5B,yBAAiB;AACjB,yBAAiB;AACjB,yBAAiB,SAAS;AAAA,MAC9B;AACA,cAAQ,gBAAgB,gBAAgB,OAAO,MAAM;AACrD,eAAS,IAAI,GAAG,IAAI,SAAS,OAAO,iBAAiB,MAAM,iBAAiB,MAAM,iBAAiB,MAAM,iBAAiB,MAAM,KAAK;AACjI,cAAM,KAAK,aAAa,KAAK,KAAK,KAAK,gBAAgB,IAAI,YAAY;AACvE,cAAM,KAAK,aAAa,KAAK,KAAK,KAAK,gBAAgB,IAAI,YAAY;AACvE,cAAM,KAAK,aAAa,KAAK,KAAK,KAAK,gBAAgB,IAAI,YAAY;AACvE,cAAM,KAAK,aAAa,IACpB,mBAAmB,KAAK,OAAO,KAAK,KAAK,gBAAgB,IAAI,YAAY;AAAA,MACjF;AAAA,IACJ,OACK;AACD,YAAM,IAAI,MAAM,2BAA2B;AAAA,IAC/C;AACA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA,EAGA,QAAQ,MAAM;AACV,WAAO,IAAI,OAAO,KAAK,MAAM,KAAK,MAAM,IAAI;AAAA,EAChD;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tensor.js","sources":["../../../../../node_modules/onnxruntime-common/dist/lib/tensor.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\nimport { Tensor as TensorImpl } from './tensor-impl';\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const Tensor = TensorImpl;\n//# sourceMappingURL=tensor.js.map"],"names":["TensorImpl"],"mappings":";AAIY,MAAC,SAASA;","x_google_ignoreList":[0]}
|