UNPKG

@hoff97/tensor-js

Version:

PyTorch like deep learning inferrence library

24 lines (23 loc) 799 B
import { Variable } from '../autograd/variable'; import Tensor from '../types'; import { Backend } from '../util/convert'; export declare type Mode = 'train' | 'inference'; /** * A module is a self contained unit that transforms * a list of inputs when forward is called. * * It can be in two modes, training and inference. * In training mode, gradients will be tracked, while * in inference mode, only the forward pass will be calculated */ export declare abstract class Module { backend: Backend; mode: Mode; abstract forward(inputs: Tensor<any>[]): Promise<Tensor<any>[]>; getSubModules(): Module[]; getParameters(): Variable<any>[]; toBackend(backend: Backend): Promise<void>; toCPU(): Promise<void>; toWASM(): Promise<void>; toGPU(): Promise<void>; }