-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Labels
Description
The DiffResults documentation clearly states that whenever a DiffResult
object is used, it must be realiased at the end of the function call:
result = do_stuff!(result, args...)
See for instance the docstrings in https://juliadiff.org/DiffResults.jl/stable/#Mutating-a-DiffResult, or the issue DiffResults#17
This is not done by ReverseDiff, for instance here:
ReverseDiff.jl/src/api/gradients.jl
Lines 21 to 27 in c982cde
function gradient(f, input, cfg::GradientConfig = GradientConfig(input)) | |
tape = GradientTape(f, input, cfg) | |
result = construct_result(input_hook(tape)) | |
seeded_reverse_pass!(result, tape) | |
empty!(cfg.tape) | |
return result | |
end |
Am I right in deducing that it can lead to incorrectness?