Skip to content

Proposal: replace Variable.volatile with global switch #3627

@colesbury

Description

@colesbury

Variable.volatile forces outputs to not require gradients if any of the inputs are marked volatile. This works OK in the forward pass, but we're forced to change the meaning in the backwards. Gradients are sometimes volatile and sometimes not, which is awkward if you add them back to parameters, such as in optimizers.

We should replace volatile with a context manager in Python. (Chainer already did this with no_backprop_mode()).

At the C++ level, we should replace it with a thread-local global switch.

This will simplify the logic in the backwards: by default backwards() will set "no-backprop mode", unless create_graph is True.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions