Skip to content

Commit fc5f754

Browse files
committed
fix copy on convert
1 parent 46a48c4 commit fc5f754

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/construction.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ end
3939

4040
similar(x::X, ::Type{T}, size::Base.Dims{N}) where {X <: GPUArray, T, N} = similar(X, T, size)
4141

42+
convert(AT::Type{<: GPUArray{T, N}}, A::GPUArray{T, N}) where {T, N} = A
43+
4244
function convert(AT::Type{<: GPUArray{T, N}}, A::DenseArray{T, N}) where {T, N}
4345
copy!(AT(Base.size(A)), A)
4446
end
47+
4548
function convert(AT::Type{<: GPUArray{T1}}, A::DenseArray{T2}) where {T1, T2}
4649
copy!(similar(AT, T1, size(A)), T1.(A))
4750
end

0 commit comments

Comments
 (0)