Skip to content

Add ChainRulesCore RuleConfig? #238

Open
@gdalle

Description

@gdalle

The macro @grad_from_chainrules contains the following line

output_value, back = ChainRulesCore.rrule($f, map(ReverseDiff.value, args)...; $kwargs...)

which shows that the rrule is used with no optional RuleConfig argument. This is proving cumbersome for ImplicitDifferentiation.jl, where the rrule needs to call back into AD and thus dispatch on the AD backend (aka RuleConfig).

Would you be open to a PR defining the following config?

using ChainRulesCore: RuleConfig, HasReverseMode, NoForwardsMode

struct MyReverseDiffRuleConfig <: RuleConfig{Union{HasReverseMode,NoForwardsMode}} end

I would need advice on how to add it to the macro though.

Pinging @mohamed82008

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