import { TimingInfo } from '../engine'; import { NDArrayMath } from '../math'; import { Conv2DInfo } from '../ops/conv_util'; import { DataId, Tensor, Tensor1D, Tensor2D, Tensor3D, Tensor4D } from '../tensor'; import { DataType, TypedArray } from '../types'; import { KernelBackend } from './backend'; import { GPGPUContext } from './webgl/gpgpu_context'; import { TextureData } from './webgl/tex_util'; import { TextureManager } from './webgl/texture_manager'; export interface CPUTimerQuery { startMs: number; endMs?: number; } export interface WebGLTimingInfo extends TimingInfo { uploadWaitMs: number; downloadWaitMs: number; } export declare class MathBackendWebGL implements KernelBackend { private gpgpu; private delayedStorage; private texData; private canvas; private programTimersStack; private activeTimers; private uploadWaitMs; private downloadWaitMs; register(dataId: DataId, shape: number[], dtype: DataType): void; fromPixels(pixels: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, numChannels: number): Tensor3D; write(dataId: DataId, values: TypedArray): void; readSync(dataId: DataId): TypedArray; read(dataId: DataId): Promise; time(f: () => void): Promise; memory(): { unreliable: boolean; }; private startTimer(); private endTimer(query); private getQueryTime(query); disposeData(dataId: DataId): void; getTexture(dataId: DataId): WebGLTexture; getTextureData(dataId: DataId): TextureData; private textureManager; private binaryCache; private gpgpuCreatedLocally; constructor(gpgpu?: GPGPUContext, delayedStorage?: boolean); getGPGPUContext(): GPGPUContext; slice(x: T, begin: number[], size: number[]): T; reverse(x: T, axis: number[]): T; concat(a: Tensor2D, b: Tensor2D): Tensor2D; neg(x: T): T; matMul(a: Tensor2D, b: Tensor2D, transposeA: boolean, transposeB: boolean): Tensor2D; multiply(a: Tensor, b: Tensor): Tensor; batchNormalization4D(x: Tensor4D, mean: Tensor4D | Tensor1D, variance: Tensor4D | Tensor1D, varianceEpsilon: number, scale?: Tensor4D | Tensor1D, offset?: Tensor4D | Tensor1D): Tensor4D; localResponseNormalization4D(x: Tensor4D, radius: number, bias: number, alpha: number, beta: number, normRegion: 'acrossChannels' | 'withinChannel'): Tensor4D; tile(x: T, reps: number[]): T; pad(x: T, paddings: Array<[number, number]>, constantValue: number): T; transpose(x: T, perm: number[]): T; gather(x: T, indices: Tensor1D, axis: number): T; private reduce(x, reduceType, dtype); private argReduce(x, reduceType, bestIndicesA?); sum(x: Tensor, axes: number[]): Tensor; argMin(x: Tensor, axes: number[]): Tensor; argMax(x: Tensor, axes: number[]): Tensor; equal(a: Tensor, b: Tensor): Tensor; notEqual(a: Tensor, b: Tensor): Tensor; less(a: Tensor, b: Tensor): Tensor; lessEqual(a: Tensor, b: Tensor): Tensor; greater(a: Tensor, b: Tensor): Tensor; greaterEqual(a: Tensor, b: Tensor): Tensor; logicalNot(x: T): T; logicalAnd(a: Tensor, b: Tensor): Tensor; logicalOr(a: Tensor, b: Tensor): Tensor; logicalXor(a: Tensor, b: Tensor): Tensor; where(condition: Tensor, a: Tensor, b: Tensor, dtype: DataType): Tensor; topKValues(x: T, k: number): Tensor1D; topKIndices(x: Tensor, k: number): Tensor1D; min(x: Tensor, axes: number[]): Tensor; minimum(a: Tensor, b: Tensor): Tensor; max(x: Tensor, axes: number[]): Tensor; maximum(a: Tensor, b: Tensor): Tensor; divide(a: Tensor, b: Tensor): Tensor; add(a: Tensor, b: Tensor): Tensor; subtract(a: Tensor, b: Tensor): Tensor; pow(a: T, b: Tensor): T; ceil(x: T): T; floor(x: T): T; exp(x: T): T; log(x: T): T; sqrt(x: T): T; square(x: T): T; relu(x: T): T; elu(x: T): T; eluDer(x: T): T; selu(x: T): T; leakyRelu(x: T, alpha: number): T; prelu(a: T, b: T): T; preluDer(a: T, b: T): T; int(x: T): T; clip(x: T, min: number, max: number): T; abs(x: T): T; sigmoid(x: T): T; sin(x: T): T; cos(x: T): T; tan(x: T): T; asin(x: T): T; acos(x: T): T; atan(x: T): T; sinh(x: T): T; cosh(x: T): T; tanh(x: T): T; step(x: T, alpha: number): T; conv2d(x: Tensor4D, filter: Tensor4D, convInfo: Conv2DInfo): Tensor4D; conv2dDerInput(dy: Tensor4D, filter: Tensor4D, convInfo: Conv2DInfo): Tensor4D; conv2dDerFilter(x: Tensor4D, dy: Tensor4D, convInfo: Conv2DInfo): Tensor4D; depthwiseConv2D(x: Tensor4D, filter: Tensor4D, convInfo: Conv2DInfo): Tensor4D; maxPool(x: Tensor4D, convInfo: Conv2DInfo): Tensor4D; minPool(x: Tensor4D, convInfo: Conv2DInfo): Tensor4D; avgPool(x: Tensor4D, convInfo: Conv2DInfo): Tensor4D; maxPoolBackprop(dy: Tensor4D, x: Tensor4D, convInfo: Conv2DInfo): Tensor4D; avgPoolBackprop(dy: Tensor4D, x: Tensor4D, convInfo: Conv2DInfo): Tensor4D; resizeBilinear(x: Tensor4D, newHeight: number, newWidth: number, alignCorners: boolean): Tensor4D; multinomial(probs: Tensor2D, numSamples: number, seed: number): Tensor2D; oneHot(indices: Tensor1D, depth: number, onValue: number, offValue: number): Tensor2D; private makeOutputArray(shape, dtype); private compileAndRun(program, inputs, output?, customSetup?); private getAndSaveBinary(key, getBinary); getTextureManager(): TextureManager; private disposed; dispose(): void; private throwIfNoData(dataId); private uploadToGPU(dataId); private cacheOnCPU(dataId, float32Values?); } export declare class NDArrayMathGPU extends NDArrayMath { constructor(gpgpu?: GPGPUContext, safeMode?: boolean); }