Skip to content
Merged
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
48 changes: 47 additions & 1 deletion src/internal_rules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ function EnzymeRules.augmented_primal(
start::Annotation{<:AbstractFloat},
step::Annotation{<:AbstractFloat},
stop::Annotation{<:AbstractFloat},
) where RT <: Active
) where RT <: Union{Active,Const}

if EnzymeRules.needs_primal(config)
primal = func.val(start.val, step.val, stop.val)
Expand All @@ -1394,6 +1394,52 @@ function EnzymeRules.augmented_primal(
}(primal, nothing, nothing)
end

function EnzymeRules.reverse(
config::EnzymeRules.RevConfig,
func::Const{Colon},
dret::Const,
tape::Nothing,
start::Annotation{T1},
step::Annotation{T2},
stop::Annotation{T3},
) where {T1<:AbstractFloat,T2<:AbstractFloat,T3<:AbstractFloat}
dstart = if start isa Const
nothing
elseif EnzymeRules.width(config) == 1
zero(T1)
else
ntuple(Val(EnzymeRules.width(config))) do i
Base.@_inline_meta
zero(T1)
end
end

dstep = if step isa Const
nothing
elseif EnzymeRules.width(config) == 1
zero(T2)
else
ntuple(Val(EnzymeRules.width(config))) do i
Base.@_inline_meta
zero(T2)
end
end

dstop = if stop isa Const
nothing
elseif EnzymeRules.width(config) == 1
zero(T3)
else
ntuple(Val(EnzymeRules.width(config))) do i
Base.@_inline_meta
zero(T3)
end
end

return (dstart, dstep, dstop)
end


function EnzymeRules.reverse(
config::EnzymeRules.RevConfig,
func::Const{Colon},
Expand Down
Loading