Skip to content

Syntactic sugar for vjp #1853

@gdalle

Description

@gdalle

As discussed on Slack, it is sometimes annoying to use reverse mode because you need autodiff_thunk whenever

  • the function output is a number and the cotangent is different from 1.0
  • the function output is anything but a number

A solution suggested by @wsmoses would be syntactic sugar for vjp (and maybe jvp but that is less necessary cause autodiff gets the job done every time). There are a few design questions around this:

  • Should we put dreturn together with the return activity?
    • Good: 1 argument instead of 2
    • Bad: in the case of Duplicated returns, we would have to specify dreturn = Duplicated(whatever, actual_thing_we_care_about).
  • Can we generalize this to batch mode vjp? How do we pass several cotangents if the return value is Active?

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