Open maleadt opened 5 years ago
julia> view(CuArray([1]), CuArray([1])) 1-element view(::CuArray{Int64,1}, [1]) with eltype Int64: 1 julia> parentindices(ans) ([1],) julia> typeof(ans) Tuple{CuArray{Int64,1}}
The indices needs an adapt as well:
Adapt.adapt_structure(to, A::SubArray{<:Any,<:Any,AT}) where {AT} = SubArray(adapt(to, parent(A)), adapt.(Ref(to), parentindices(A)))
Reported by @ali-ramadhan
This is actually a little more complex, because the view constructor does bounds checking:
view
julia> view(CuArray([1]), CuArray([1])) ERROR: scalar getindex is disallowed
The indices needs an adapt as well:
Reported by @ali-ramadhan