Skip to content

DiffResults objects are not re-aliased properly #251

@gdalle

Description

@gdalle

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:

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions