onnxruntime/js/web/lib/onnxjs/operators.ts
Yulong Wang 4ebc9c3b5e
[JS] onnxruntime-web (#7394)
* add web

* add script and test

* fix lint

* add test/data/ops

* add test/data/node/ to gitignore

* modify scripts

* add onnxjs

* fix tests

* fix test-runner

* fix sourcemap

* fix onnxjs profiling

* update test list

* update README

* resolve comments

* set wasm as default backend

* rename package

* update copyright header

* do not use class "Buffer" in browser context

* revise readme
2021-04-27 00:04:25 -07:00

18 lines
810 B
TypeScript

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import {Attribute} from './attribute';
import {InferenceHandler} from './backend';
import {Graph} from './graph';
import {Tensor} from './tensor';
export interface Operator {
initialize(attributes: Attribute, node: Graph.Node, graph: Graph): void;
checkInputs(inputs: Tensor[]): boolean;
run(inferenceHandler: InferenceHandler, inputs: Tensor[]): Tensor[]|Promise<Tensor[]>;
}
export const NUMBER_TYPES: readonly Tensor.DataType[] =
['float32', 'float64', 'int32', 'int16', 'int8', 'uint16', 'uint32', 'uint8'];
export const INT_TYPES: readonly Tensor.DataType[] = ['int32', 'int16', 'int8', 'uint16', 'uint32', 'uint8'];
export const FLOAT_TYPES: readonly Tensor.DataType[] = ['float32', 'float64'];