Skip to content

Commit d94f146

Browse files
authored
Apply suggestions from code review
1 parent 3c5f99e commit d94f146

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

DifferentiationInterface/docs/src/faq/differentiability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,4 @@ There are, however, translation utilities:
112112

113113
Also note the existence of [`DifferentiationInterface.DifferentiateWith`](@ref), which allows the user to wrap a function that should be differentiated with a specific backend.
114114

115-
Right now, it only targets [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl), [Mooncake.jl](), [ChainRules.jl](https://juliadiff.org/ChainRulesCore.jl/stable/)-compatible backends (e.g., [Zygote.jl](https://github.com/FluxML/Zygote.jl)), but PRs are welcome to define Enzyme.jl rules for this object.
115+
Right now, it only targets [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl), [Mooncake.jl](), [ChainRules.jl](https://juliadiff.org/ChainRulesCore.jl/stable/)-compatible backends (e.g., [Zygote.jl](https://github.com/FluxML/Zygote.jl)), but PRs are welcome to define Enzyme.jl rules for this object.

DifferentiationInterface/ext/DifferentiationInterfaceMooncakeExt/differentiate_with.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ function Mooncake.rrule!!(
4040

4141
pullback = if tangent_type(typeof(primal(x))) <: NoTangent
4242
pullback_nodiff!!
43-
elseif typeof(primal(y)) <: Number
43+
elseif primal(y) isa Number
4444
pullback_scalar!!
45-
elseif typeof(primal(y)) <: Array
45+
elseif primal(y) <: AbstractArray
4646
pullback_array!!
47-
elseif typeof(primal(y)) <: Tuple
47+
elseif primal(y) <: Tuple
4848
pullback_tuple!!
4949
else
5050
error(
@@ -94,11 +94,11 @@ function Mooncake.rrule!!(dw::CoDual{<:DI.DifferentiateWith}, x::CoDual{<:Abstra
9494

9595
pullback = if tangent_type(typeof(primal(x))) <: Vector{NoTangent}
9696
pullback_nodiff!!
97-
elseif typeof(primal(y)) <: Number
97+
elseif primal(y) isa Number
9898
pullback_scalar!!
99-
elseif typeof(primal(y)) <: AbstractArray
99+
elseif primal(y) <: AbstractArray
100100
pullback_array!!
101-
elseif typeof(primal(y)) <: Tuple
101+
elseif primal(y) <: Tuple
102102
pullback_tuple!!
103103
else
104104
error(

0 commit comments

Comments
 (0)