UNPKG

@hoff97/tensor-js

Version:

PyTorch like deep learning inferrence library

17 lines 673 B
import { CPUTensor } from '../../../tensor/cpu/tensor'; import { WASMTensor } from '../../../tensor/wasm/tensor'; import { reshapeCPU } from './cpu'; import { reshapeGPU } from './gpu'; import { reshapeWasm } from './wasm'; export function reshape(tensor, shape, copy) { if (tensor.values instanceof CPUTensor) { return reshapeCPU(tensor, tensor.values, tensor.indices, shape, copy); } else if (tensor.values instanceof WASMTensor) { return reshapeWasm(tensor, tensor.values, tensor.indices, shape, copy); } else { return reshapeGPU(tensor, tensor.values, tensor.indices, shape, copy); } } //# sourceMappingURL=reshape.js.map