UNPKG

@thi.ng/tensors

Version:

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

23 lines 899 B
import type { NumericArray } from "@thi.ng/api"; /** * Simplified interface of thi.ng/pixel `FloatBuffer`, only defining parts * relevant to the conversion. */ export interface FloatBufferLike { size: [number, number]; stride: [number, number]; data: NumericArray; format: { size: number; }; } /** * Helper function to coerce a thi.ng/pixel float buffer (or compatible data * structures) into a tensor. Single-channel (i.e. grayscale) buffers will * result in 2D tensors, otherwise 3D (with the innermost dimension representing * different color channels). In all cases, this is a zero-copy operation. * * @param buffer */ export declare const fromFloatBuffer: ({ size: [sx, sy], stride: [tx, ty], data, format: { size }, }: FloatBufferLike) => import("./tensor.js").Tensor3<number> | import("./tensor.js").Tensor2<number>; //# sourceMappingURL=convert.d.ts.map