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:
27
node_modules/onnxruntime-web/lib/onnxjs/backends/webgl/ops/cast.ts
generated
vendored
Normal file
27
node_modules/onnxruntime-web/lib/onnxjs/backends/webgl/ops/cast.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import {Graph} from '../../../graph';
|
||||
import {OperatorImplementation, OperatorInitialization} from '../../../operators';
|
||||
import {Tensor} from '../../../tensor';
|
||||
import {ProtoUtil} from '../../../util';
|
||||
import {WebGLInferenceHandler} from '../inference-handler';
|
||||
|
||||
export const cast: OperatorImplementation<Tensor.DataType> =
|
||||
(handler: WebGLInferenceHandler, inputs: Tensor[], to: Tensor.DataType): Tensor[] => {
|
||||
validateInputs(inputs);
|
||||
return [handler.cast(inputs[0], to)];
|
||||
};
|
||||
|
||||
export const parseCastAttributes: OperatorInitialization<Tensor.DataType> = (node: Graph.Node): Tensor.DataType =>
|
||||
ProtoUtil.tensorDataTypeFromProto(node.attributes.getInt('to'));
|
||||
|
||||
const validateInputs = (inputs: Tensor[]): void => {
|
||||
if (!inputs || inputs.length !== 1) {
|
||||
throw new Error('Cast requires 1 input.');
|
||||
}
|
||||
|
||||
if (inputs[0].type === 'string') {
|
||||
throw new Error('Invalid input type.');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user