swift
0d17ddfa - [AutoDiff] Destroy all pullback indirect results after adjoint accumulation. (#27711)

Commit
6 years ago
[AutoDiff] Destroy all pullback indirect results after adjoint accumulation. (#27711) When we differentiate a function (example below) with respect to a proper subset of its indirect parameters and when the function only has a derivative with respect to a proper superset of those indirect parameters, the pullback returns more indirect results than we need. However, unneeded indirect results are not destroyed, which causes a memory lifetime verification failure. This patch fixes this bug by releasing all pullback indirect results instead of just releasing the ones needed for calculating the derivative. ```swift @differentiable(wrt: x) func foo<T: Differentiable>(_ x: T, _ y: T, apply: @differentiable (T, T) -> T) -> T { return apply(x, y) } ``` This patch also uncomments a test in test/AutoDiff/superset_adjoint.swift which is now passing. This fixed a FIXME. Resolves [TF-914](https://bugs.swift.org/browse/TF-914).
Author
Parents
Loading