@thi.ng/tensors
Version:
0D/1D/2D/3D/4D tensors with extensible polymorphic operations and customizable storage
27 lines • 2.21 kB
TypeScript
import type { Fn2, Fn3, Fn4, Fn5, FnN, FnN2 } from "@thi.ng/api";
import type { ITensor } from "./api.js";
import { type Tensor1 } from "./tensor.js";
type BoundaryFn = FnN2;
type Sampler1 = Fn2<ITensor, number, number>;
type Sampler2 = Fn3<ITensor, number, number, number>;
type Sampler3 = Fn4<ITensor, number, number, number, number>;
type Sampler4 = Fn5<ITensor, number, number, number, number, number>;
type BoundaryType = "clamp" | "mirror" | "wrap" | "zero";
type SamplerType = "nearest" | "linear" | "cubic" | "lanczos";
interface SamplerKernel {
radius: number;
weight: FnN;
}
export declare const SAMPLE_NEAREST: SamplerKernel;
export declare const SAMPLE_LINEAR: SamplerKernel;
export declare const SAMPLE_CUBIC: SamplerKernel;
export declare const SAMPLE_LANCZOS: (r?: number) => SamplerKernel;
export declare const defSampler1: (kernel: SamplerKernel | SamplerType, boundary?: BoundaryFn | BoundaryType) => Sampler1;
export declare const defSampler2: (kernel: SamplerType | SamplerKernel | [SamplerType | SamplerKernel, SamplerType | SamplerKernel], boundary?: BoundaryType | BoundaryFn | [BoundaryType | BoundaryFn, BoundaryType | BoundaryFn]) => Sampler2;
export declare const defSampler3: (kernel: SamplerType | SamplerKernel | [SamplerType | SamplerKernel, SamplerType | SamplerKernel, SamplerType | SamplerKernel], boundary?: BoundaryType | BoundaryFn | [BoundaryType | BoundaryFn, BoundaryType | BoundaryFn, BoundaryType | BoundaryFn]) => Sampler3;
export declare const defSampler4: (kernel: SamplerType | SamplerKernel | [SamplerType | SamplerKernel, SamplerType | SamplerKernel, SamplerType | SamplerKernel, SamplerType | SamplerKernel], boundary?: BoundaryType | BoundaryFn | [BoundaryType | BoundaryFn, BoundaryType | BoundaryFn, BoundaryType | BoundaryFn, BoundaryType | BoundaryFn]) => Sampler4;
export declare const resample1: (out: Tensor1, a: Tensor1, sampler: Sampler1) => Tensor1<number>;
export declare const resample2: (out: ITensor, a: ITensor, [samplerX, samplerY]: Sampler1[]) => ITensor<number>;
export declare const resample3: (out: ITensor, a: ITensor, [samplerX, samplerY, samplerZ]: Sampler1[]) => ITensor<number>;
export {};
//# sourceMappingURL=sample.d.ts.map