Skip to content
This repository was archived by the owner on Mar 12, 2021. It is now read-only.

Commit 58ded6a

Browse files
authored
Merge pull request #530 from JuliaGPU/tb/copy_ctors
Clean-up copy constructors.
2 parents 6d56601 + 79d700d commit 58ded6a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/array.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,11 @@ Base.pointer(x::CuArray, i::Integer) = x.ptr + (i-1) * Base.elsize(x)
172172

173173
@inline function CuArray{T,N}(xs::AbstractArray{T,N}) where {T,N}
174174
A = CuArray{T,N}(undef, size(xs))
175-
if isbits(xs)
176-
A .= xs
177-
else
178-
copyto!(A, collect(xs))
179-
end
175+
copyto!(A, xs)
180176
return A
181177
end
182178

179+
# FIXME: `map(T, xs)`, https://github.com/FluxML/Flux.jl/issues/958
183180
CuArray{T,N}(xs::AbstractArray{S,N}) where {T,N,S} = CuArray{T,N}((x -> T(x)).(xs))
184181

185182
# underspecified constructors

0 commit comments

Comments
 (0)