UNPKG

@hoff97/tensor-js

Version:

PyTorch like deep learning inferrence library

21 lines 488 B
export class ReshapeBack { constructor(a) { this.a = a; } backward(grad) { const shapeA = this.a.getShape(); if (!this.a.noGrad) { const gradA = grad.reshape(shapeA); const needed = this.a.backward(gradA); if (!needed) { gradA.delete(); } } } delete() { if (!this.a.isLeaf()) { this.a.delete(); } } } //# sourceMappingURL=reshapeBack.js.map