UNPKG

@hoff97/tensor-js

Version:

PyTorch like deep learning inferrence library

19 lines 440 B
export class ExpBack { constructor(input, exp) { this.input = input; this.exp = exp; } backward(grad) { const gradExp = grad.multiply(this.exp); const needed = this.input.backward(gradExp); if (!needed) { gradExp.delete(); } } delete() { if (!this.input.isLeaf()) { this.input.delete(); } } } //# sourceMappingURL=expBack.js.map