Skip to content

Commit

Permalink
Sort in augmented primal
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreener64 committed Aug 16, 2023
1 parent 82e44ea commit f56cbe8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/internal_rules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,17 @@ function EnzymeRules.augmented_primal(
kwargs...
)
inds = sortperm(xs.val; kwargs...)
xs.val .= xs.val[inds]
xs.dval .= xs.dval[inds]
if EnzymeRules.needs_primal(config)
primal = xs.val[inds]
primal = xs.val
else
primal = nothing
end
if RT <: Const
shadow = nothing
else
shadow = xs.dval[inds]
shadow = xs.dval
end
return EnzymeRules.AugmentedReturn(primal, shadow, inds)
end
Expand Down

0 comments on commit f56cbe8

Please sign in to comment.