Skip to content

Commit 2fe8831

Browse files
committed
Add more isinteresting methods
1 parent e86af58 commit 2fe8831

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

profile.pb.gz

-11.6 KB
Binary file not shown.

src/dual_context.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,12 @@ end
108108
@inline isinteresting(ctx::TaggedCtx, f, a, b, c) = anydual(a, b, c)
109109
@inline isinteresting(ctx::TaggedCtx, f, a, b, c, d) = anydual(a, b, c, d)
110110
@inline isinteresting(ctx::TaggedCtx, f, args...) = false
111-
@inline isinteresting(ctx::TaggedCtx, f::typeof(Base.show), args...) = false
111+
@inline isinteresting(ctx::TaggedCtx, f::Core.Builtin, args...) = false
112+
@inline isinteresting(ctx::TaggedCtx, f::Union{typeof(Base.show),typeof(Base.print)}, args...) = false
113+
@inline isinteresting(ctx::TaggedCtx, f::Union{typeof(Base.setindex!),typeof(Base.getindex)}, ::DualArray, args...) = false
114+
@inline isinteresting(ctx::TaggedCtx, f::Union{typeof(Base.getproperty)}, ::Union{DualArray,Dual}, args...) = false
115+
@inline isinteresting(ctx::TaggedCtx, f::Union{typeof(ForwardDiff2.find_dual),
116+
typeof(ForwardDiff2.anydual)}, args...) = false
112117

113118
@specialize_vararg 4 @inline function _frule_overdub2(ctx::TaggedCtx{T}, f::F, args...) where {T,F}
114119
# Here we can assume that one or more `args` is a Dual with tag

src/dualnumber.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ dualtag() = nothing
8989

9090
@inline partials(d::Dual) = d.partials
9191

92-
@inline npartials(d::Dual) = (ps=d.partials) isa ChainRulesCore.AbstractDifferential ? 1 : length(d.partials)
92+
@inline npartials(d::Dual) = (ps = partials(d)) isa ChainRulesCore.AbstractDifferential ? 1 : length(d.partials)
9393

9494
#####################
9595
# Generic Functions #

0 commit comments

Comments
 (0)