UNPKG

@thi.ng/tensors

Version:

0D/1D/2D/3D/4D tensors with extensible polymorphic operations and customizable storage

26 lines 2.19 kB
import type { Fn2, Fn3, Fn4, Fn5, FnN, FnN2 } from "@thi.ng/api"; import type { ITensor1, ITensor2, ITensor3, ITensor4 } from "./api.js"; type BoundaryFn = FnN2; type Sampler1 = Fn2<ITensor1, number, number>; type Sampler2 = Fn3<ITensor2, number, number, number>; type Sampler3 = Fn4<ITensor3, number, number, number, number>; type Sampler4 = Fn5<ITensor4, 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: ITensor1, a: ITensor1, sampler: Sampler1) => ITensor1; export declare const resample2: (out: ITensor2, a: ITensor2, [samplerX, samplerY]: Sampler1[]) => ITensor2; export declare const resample3: (out: ITensor3, a: ITensor3, [samplerX, samplerY, samplerZ]: Sampler1[]) => ITensor3; export {}; //# sourceMappingURL=sample.d.ts.map