(tensors)
| 676 | const {forwardFunc} = kernelParams; |
| 677 | // Running a customGrad op. |
| 678 | const saveFunc: GradSaveFunc = (tensors) => { |
| 679 | // Do not save unless we are recording to the tape. Otherwise it would |
| 680 | // cause a mem leak since we would never run backprop, which disposes |
| 681 | // the kept tensors. |
| 682 | if (!isTapeOn) { |
| 683 | return; |
| 684 | } |
| 685 | saved = tensors.map(tensor => this.keep(this.clone(tensor))); |
| 686 | }; |
| 687 | |
| 688 | kernelFunc = () => { |
| 689 | const numDataIdsBefore = this.backend.numDataIds(); |