chore: update node_modules with new binary files and dependencies
- Add new binary files for nodemon, onnxruntime-web, and xenova/transformers - Update various JavaScript and TypeScript files in node_modules - Remove unused files and dependencies - Add new test fixtures and documentation files
This commit is contained in:
31
node_modules/onnxruntime-web/lib/onnxjs/backends/webgl/ops/flatten.js
generated
vendored
Normal file
31
node_modules/onnxruntime-web/lib/onnxjs/backends/webgl/ops/flatten.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseFlattenAttributes = exports.flatten = void 0;
|
||||
const util_1 = require("../../../util");
|
||||
const flatten = (inferenceHandler, inputs, axis) => {
|
||||
validateInputs(inputs, axis);
|
||||
const outputDims = util_1.ShapeUtil.flattenShape(inputs[0].dims, axis);
|
||||
return [inferenceHandler.reshapeUnpacked(inputs[0], outputDims)];
|
||||
};
|
||||
exports.flatten = flatten;
|
||||
const parseFlattenAttributes = (node) => node.attributes.getInt('axis', 1); // default axis is 1
|
||||
exports.parseFlattenAttributes = parseFlattenAttributes;
|
||||
const validateInputs = (inputs, axis) => {
|
||||
if (!inputs || inputs.length !== 1) {
|
||||
throw new Error('Flatten requires 1 input.');
|
||||
}
|
||||
const r = inputs[0].dims.length;
|
||||
if (r === 0) {
|
||||
throw new Error('scalar tensor is not supported.');
|
||||
}
|
||||
if (axis < -r || axis > r) {
|
||||
throw new Error('Invalid axis');
|
||||
}
|
||||
// TODO: Support string type
|
||||
if (inputs[0].type === 'string') {
|
||||
throw new Error('string tensor is not supported.');
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=flatten.js.map
|
||||
Reference in New Issue
Block a user