UNPKG

@hoff97/tensor-js

Version:

PyTorch like deep learning inferrence library

39 lines (38 loc) 1.89 kB
import { DTypeGpu, GPUTensorConstructor, GPUTensorI } from '../../../tensor/gpu/interface'; import { GPUMemoryAllocator } from '../../../tensor/gpu/memory'; import { GPUTensor } from '../../../tensor/gpu/tensor'; import { SparseTensor } from '../../../tensor/sparse/tensor'; import { Dispatcher } from '../../gpu/dispatcher'; import { Input, Operation } from '../../gpu/operation'; export interface ReshapeIndicesInfo { shapeA?: readonly number[]; widthA?: number; heightA?: number; shapeOutput?: readonly number[]; widthOutput?: number; heightOutput?: number; nnzFraction?: number; sparseDims?: number; oldSparseStrides?: number[]; newSparseStrides?: number[]; } export interface ReshapeIndicesInput { A: GPUTensorI; sparseShape: readonly number[]; shape: readonly number[]; nnz: number; } export declare class ReshapeIndicesOperation<GPUTensor extends GPUTensorI> extends Operation<GPUTensor, ReshapeIndicesInfo, ReshapeIndicesInput> { constructor(tensorConstructor: GPUTensorConstructor<GPUTensor>, dtype: DTypeGpu, allocator?: GPUMemoryAllocator); getVariables(): string; getUniformAttrs(): Input[]; getFragmentShader(info: ReshapeIndicesInfo): string; getTextureNames(): string[]; calc(input: ReshapeIndicesInput): GPUTensor; getOutputShape(input: ReshapeIndicesInput): readonly number[]; compile(info: ReshapeIndicesInfo): void; getCompilationInfo(input: ReshapeIndicesInput): ReshapeIndicesInfo; getInputInfoString(input: ReshapeIndicesInput): string; } export declare const defaultReshapeIndicesD: Dispatcher<GPUTensorI, unknown, unknown, ReshapeIndicesOperation<GPUTensor<DTypeGpu>>>; export declare function reshapeGPU<DTpe extends DTypeGpu>(tensor: SparseTensor<DTpe>, values: GPUTensor<DTpe>, indices: GPUTensor<'uint32'>, shape: readonly number[], copy: boolean): SparseTensor<DTpe>;