@thi.ng/tensors
Version:
0D/1D/2D/3D/4D tensors with extensible polymorphic operations and customizable storage
28 lines • 1.31 kB
TypeScript
import type { KernelSpec, ITensor } from "./api.js";
/**
* Generalized convolution using a set of kenrel functions instead of static
* kernel tensor (as with {@link convolve}). The kernel function is applied as a
* windowed reducer. For each window (size defined by the kernel), the
* {@link KernelSpec.init} function initializes an accumulator value. Then
* {@link KernelSpec.reduce} is called with the current accumulator, a domain
* value from tensor `a` and the current kernel coordinates. The final window
* result is produced by the kernel's {@link KernelSpec.complete} function.
*
* @remarks
* The output tensor has the same shape as domain `a`. If `pad = true`
* (default), edge values in `a` will be repeated, otherwise padded with given
* value. If `out` is null, a new tensor will be created using `a`'s storage
* backend.
*
* References:
*
* - https://en.wikipedia.org/wiki/Convolution
* - https://en.wikipedia.org/wiki/Kernel_(image_processing)#Convolution
*
* @param out - output tensor
* @param a - input tensor
* @param kernel - kernel spec
* @param pad - padding
*/
export declare const applyKernel: import("./api.js").MultiTensorOpImpl<(<T extends ITensor>(out: T | null, a: T, kernel: KernelSpec, pad?: true | number) => T)>;
//# sourceMappingURL=apply-kernel.d.ts.map