Skip to content

Commit ddc2e3f

Browse files
committed
Appease JET
1 parent 1c9f6e1 commit ddc2e3f

4 files changed

Lines changed: 8 additions & 13 deletions

File tree

DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/utils.jl

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,7 @@ function mypartials!(::Type{T}, ty::NTuple{B}, ydual) where {T,B}
8282
return ty
8383
end
8484

85-
# store preparation result with the right input eltype
86-
struct PrepContext{T<:DI.Prep} <: DI.Context
87-
data::T
88-
end
89-
90-
NotCache = Union{DI.GeneralizedConstant,PrepContext}
91-
92-
_translate(::Type{D}, c::NotCache) where {D<:Dual} = DI.unwrap(c)
85+
_translate(::Type{D}, c::DI.GeneralizedConstant) where {D<:Dual} = DI.unwrap(c)
9386
function _translate(::Type{D}, c::DI.Cache) where {D<:Dual}
9487
c0 = DI.unwrap(c)
9588
return similar(c0, D)
@@ -102,7 +95,7 @@ function translate(::Type{D}, contexts::NTuple{C,DI.Context}) where {D<:Dual,C}
10295
return new_contexts
10396
end
10497

105-
_translate_toprep(::Type{D}, c::NotCache) where {D<:Dual} = nothing
98+
_translate_toprep(::Type{D}, c::DI.GeneralizedConstant) where {D<:Dual} = nothing
10699
function _translate_toprep(::Type{D}, c::DI.Cache) where {D<:Dual}
107100
c0 = DI.unwrap(c)
108101
return similar(c0, D)
@@ -115,7 +108,7 @@ function translate_toprep(::Type{D}, contexts::NTuple{C,DI.Context}) where {D<:D
115108
return new_contexts
116109
end
117110

118-
_translate_prepared(c::NotCache, _pc) = DI.unwrap(c)
111+
_translate_prepared(c::DI.GeneralizedConstant, _pc) = DI.unwrap(c)
119112
_translate_prepared(_c::DI.Cache, pc) = pc
120113

121114
function translate_prepared(

DifferentiationInterface/src/second_order/hvp.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,7 @@ end
551551

552552
## Reverse over reverse
553553

554-
struct ReverseOverReverseHVPPrep{G,PO<:PullbackPrep,PI<:Union{Nothing,PullbackPrep}} <:
555-
HVPPrep
554+
struct ReverseOverReverseHVPPrep{G,PO,PI} <: HVPPrep
556555
# pullback of gradient
557556
grad_buffer::G
558557
outer_pullback_prep::PO

DifferentiationInterface/src/utils/traits.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ struct DontPrepareInner <: InnerPreparationBehavior end
181181

182182
inner_preparation_behavior(::AbstractADType) = DontPrepareInner()
183183

184-
function overloaded_input end
184+
function overloaded_input(optype, f, backend, x, args...)
185+
throw(ArgumentError("Just to appease JET"))
186+
end
185187

186188
## Conversions
187189

DifferentiationInterface/test/Core/Internals/_formalities.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Aqua: Aqua
44
using DifferentiationInterface
55
using ExplicitImports
6+
using ForwardDiff: ForwardDiff
67
using JET: JET
78
using JuliaFormatter: JuliaFormatter
89
using Test

0 commit comments

Comments
 (0)