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

CLArray{Float32,2}(10,10) throws ambiguity error

Open dlfivefifty opened this issue 6 years ago • 2 comments

julia> CLArray{Float32,2}(10,10)
ERROR: MethodError: CLArrays.CLArray{Float32,2}(::Int64, ::Int64) is ambiguous. Candidates:
  (::Type{CLArrays.CLArray{T,N}})(size, ptr) where {T, N} in CLArrays at /Users/solver/.julia/v0.6/CLArrays/src/array.jl:12
  (T::Type{#s9} where #s9<:GPUArrays.GPUArray)(dims::Integer...) in GPUArrays at /Users/solver/.julia/v0.6/GPUArrays/src/construction.jl:37
Possible fix, define
  (::Type{CLArrays.CLArray{T,N}})(::Integer, ::Integer)

dlfivefifty avatar May 31 '18 19:05 dlfivefifty

What are you trying to do?

The following works fine

CLArray{Float32,2}(rand(5,4))

As well as

CLArray{Float32,2}((10,10))

I agree though, for "consitency" if both of the following ways generate a new array

Array{Float32,2}((10,10))
Array{Float32,2}(10,10)

We would expect the same to happen with a CLArray

davidbp avatar May 31 '18 20:05 davidbp

The above should be a synonym for those (as is the case for Matrix )

dlfivefifty avatar May 31 '18 21:05 dlfivefifty