UNPKG

@hoff97/tensor-js

Version:

PyTorch like deep learning inferrence library

14 lines (13 loc) 776 B
import Tensor, { DType } from '../types'; export declare type Backend = 'CPU' | 'WASM' | 'GPU'; /** * Convert a tensor to the specified backend */ export declare function toBackend<DTpe extends DType>(tensor: Tensor<DTpe>, backend: Backend): Promise<Tensor<DTpe>>; export declare function toCPU<DTpe extends DType>(tensor: Tensor<DTpe>): Promise<Tensor<DTpe>>; export declare function toWASM<DTpe extends DType>(tensor: Tensor<DTpe>): Promise<Tensor<DTpe>>; export declare function toGPU<DTpe extends DType>(tensor: Tensor<DTpe>): Promise<Tensor<DTpe>>; /** * Determines if the two tensors are of the same type, ie. if they are on the same backend */ export declare function sameType<DTpe1 extends DType, DTpe2 extends DType>(a: Tensor<DTpe1>, b: Tensor<DTpe2>): boolean;