Adapt.jl icon indicating copy to clipboard operation
Adapt.jl copied to clipboard

Replace with Flatten.jl

Open maleadt opened this issue 5 years ago • 0 comments

Turns out Flatten.jl has something similar: Flatten.modify(CuArray, obj, Array). Doesn't use rules, instead eagerly tries to reconstruct objects by calling constructure. That doesn't always work of course:

julia> Flatten.modify(CuArray, view(rand(2,2),:,:), Array)
ERROR: MethodError: no method matching SubArray(::CuArray{Float64,2}, ::Tuple{Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}}}, ::Int64, ::Int64)

Furthermore, we currently need the WrappedArray dispatch rules, but once we have Base.AbstractWrappedArray (https://github.com/JuliaLang/julia/pull/31563) we should investigate using this.

maleadt avatar Nov 12 '20 08:11 maleadt