@hoff97/tensor-js
Version:
PyTorch like deep learning inferrence library
31 lines (30 loc) • 1.26 kB
TypeScript
import { DTypeGpu, GPUTensorConstructor, GPUTensorI } from '../../../tensor/gpu/interface';
import { GPUMemoryAllocator } from '../../../tensor/gpu/memory';
import { Operation } from './../operation';
export interface BinaryOpInfo {
shapeA?: readonly number[];
widthA?: number;
heightA?: number;
shapeB?: readonly number[];
widthB?: number;
heightB?: number;
shapeOutput?: readonly number[];
widthOutput?: number;
heightOutput?: number;
}
export interface BinaryOpInput {
A: GPUTensorI;
B: GPUTensorI;
outputShape: readonly number[];
}
export declare abstract class BinaryOperation<GPUTensor extends GPUTensorI, BInfo extends BinaryOpInfo = BinaryOpInfo, BInput extends BinaryOpInput = BinaryOpInput> extends Operation<GPUTensor, BInfo, BInput> {
constructor(tensorConstructor: GPUTensorConstructor<GPUTensor>, dtype: DTypeGpu, allocator?: GPUMemoryAllocator);
abstract getOp(a: string, b: string): string;
getFragmentShader(info: BInfo): string;
getOutputShape(input: BInput): readonly number[];
getTextureNames(): string[];
calc(input: BInput): GPUTensor;
compile(info: BInfo): void;
getCompilationInfo(input: BInput): BInfo;
getInputInfoString(input: BinaryOpInput): string;
}