@hoff97/tensor-js
Version:
PyTorch like deep learning inferrence library
31 lines (30 loc) • 1.38 kB
TypeScript
import { onnx } from 'onnx-proto';
import { Tensor } from '../library';
import { Mode, Module } from '../model/module';
import { DType } from '../types';
import { Attributes, Constants } from './types';
export declare abstract class OnnxNode extends Module {
protected onnxVersion: number;
inputs: string[];
outputs: string[];
variableInputs: number;
attributes: {
[name: string]: onnx.IAttributeProto;
};
constructor(attributes: Attributes, inputs: string[], outputs: string[], constants: Constants, onnxVersion: number, mode: Mode);
initialize(resolveConstant: (name: string) => Tensor<any> | undefined): void;
getAttribute(name: string): onnx.IAttributeProto;
getAttributeString(name: string): string | undefined;
getAttributeInts(name: string): number[] | undefined;
getAttributeInt(name: string): number | null | undefined;
getAttributeFloat(name: string): number | null | undefined;
getAttributeFloats(name: string): number[] | null | undefined;
getAttributeTensor(name: string): onnx.ITensorProto | null | undefined;
toValues<DTpe extends DType>(tensor: Tensor<DTpe>): Promise<number[]>;
toCPU(): Promise<void>;
toWASM(): Promise<void>;
toGPU(): Promise<void>;
abstract forward(inputs: Tensor<any>[]): Promise<Tensor<any>[]>;
abstract getType(): string;
abstract delete(): void;
}