Skip to content

Commit

Permalink
fix: aos_to_soa for all singleton dims
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal authored Nov 18, 2024
1 parent 2643104 commit d6f380a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ext/ArrayInterfaceReverseDiffExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ ArrayInterface.ismutable(T::Type{<:ReverseDiff.TrackedReal}) = false
ArrayInterface.can_setindex(::Type{<:ReverseDiff.TrackedArray}) = false
ArrayInterface.fast_scalar_indexing(::Type{<:ReverseDiff.TrackedArray}) = false
function ArrayInterface.aos_to_soa(x::AbstractArray{<:ReverseDiff.TrackedReal, N}) where {N}
if length(x) > 1
return reshape(reduce(vcat, x), size(x))
else
return reduce(vcat,[x[1], x[1]])[1:1]
end
y = length(x) > 1 ? reduce(vcat, x) : reduce(vcat, [x[1], x[1]])[1:1]
return reshape(y, size(x))

Check warning on line 12 in ext/ArrayInterfaceReverseDiffExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/ArrayInterfaceReverseDiffExt.jl#L11-L12

Added lines #L11 - L12 were not covered by tests
end

function ArrayInterface.restructure(x::Array, y::ReverseDiff.TrackedArray)
Expand Down

0 comments on commit d6f380a

Please sign in to comment.