mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-03 03:58:54 +00:00
* [js/web] integrate latest changes from onnxjs * apply ESLint rules: filename-case and header * remove filename-case rule for wasm .d.ts
35 lines
953 B
TypeScript
35 lines
953 B
TypeScript
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
import {Attribute} from '../attribute';
|
|
import {InferenceHandler} from '../backend';
|
|
import {NUMBER_TYPES, Operator} from '../operators';
|
|
import {Tensor} from '../tensor';
|
|
|
|
export abstract class ArgMax implements Operator {
|
|
abstract run(inferenceHandler: InferenceHandler, inputs: Tensor[]): Tensor[]|Promise<Tensor[]>;
|
|
|
|
initialize(attributes: Attribute): void {
|
|
this.axis = attributes.getInt('axis', 0);
|
|
this.keepDims = attributes.getInt('keepdims', 1) === 1;
|
|
}
|
|
|
|
checkInputs(inputs: Tensor[]): boolean {
|
|
if (!inputs || inputs.length !== 1) {
|
|
return false;
|
|
}
|
|
|
|
return this.checkInputTypes(inputs);
|
|
}
|
|
|
|
protected checkInputTypes(inputs: Tensor[]): boolean {
|
|
if (NUMBER_TYPES.indexOf(inputs[0].type) === -1) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
protected axis: number;
|
|
protected keepDims: boolean;
|
|
}
|