Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ See the examples for a demonstration.

### Multiple inputs | Derivatives not needed

If your forward mapping (or conditions) takes multiple inputs but you don't care about derivatives, then you can add further positional and keyword arguments beyond `x`.
If your forward mapping (or conditions) takes multiple inputs but you don't care about derivatives, then you can add further positional arguments beyond `x`.
It is important to make sure that the forward mapping and conditions accept the same set of arguments, even if each of these functions only uses a subset of them.

```julia
Expand Down
8 changes: 2 additions & 6 deletions ext/ImplicitDifferentiationChainRulesCoreExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ using ImplicitDifferentiation:
ImplicitDifferentiation.chainrules_suggested_backend(rc::RuleConfig) = AutoChainRules(rc)

function ChainRulesCore.rrule(
rc::RuleConfig,
implicit::ImplicitFunction,
x::AbstractVector,
args::Vararg{Any,N};
kwargs...,
rc::RuleConfig, implicit::ImplicitFunction, x::AbstractVector, args::Vararg{Any,N};
) where {N}
y, z = implicit(x, args...; kwargs...)
y, z = implicit(x, args...)

suggested_backend = chainrules_suggested_backend(rc)
Aᵀ = build_Aᵀ(implicit, x, y, z, args...; suggested_backend)
Expand Down
4 changes: 2 additions & 2 deletions ext/ImplicitDifferentiationForwardDiffExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using ForwardDiff: Dual, Partials, partials, value
using ImplicitDifferentiation: ImplicitFunction, build_A, build_B

function (implicit::ImplicitFunction)(
x_and_dx::AbstractVector{Dual{T,R,N}}, args...; kwargs...
x_and_dx::AbstractVector{Dual{T,R,N}}, args...
) where {T,R,N}
x = value.(x_and_dx)
y, z = implicit(x, args...; kwargs...)
y, z = implicit(x, args...)

suggested_backend = AutoForwardDiff()
A = build_A(implicit, x, y, z, args...; suggested_backend)
Expand Down