Skip to content

Ambiguity error with rand! and tuple elements. #722

@nhz2

Description

@nhz2

MWE:

julia> using GPUArrays, JLArrays, Random

julia> A = JLArray{Tuple{Int32}}(undef, 1000);

julia> rng = GPUArrays.RNG{JLArray}(42)
GPUArrays.RNG{JLArray}(0x000000000000002a, 0x0000000000000000)

julia> Random.rand!(rng, A);
ERROR: MethodError: rand!(::GPUArrays.RNG{JLArray}, ::JLArray{Tuple{Int32}, 1}) is ambiguous.

Candidates:
  rand!(rng::GPUArrays.RNG{AT}, A::AbstractArray{T}) where {AT, T}
    @ GPUArrays ~/.julia/packages/GPUArrays/V2qKA/src/host/random.jl:583
  rand!(rng::AbstractRNG, A::AnyGPUArray)
    @ GPUArrays ~/.julia/packages/GPUArrays/V2qKA/src/host/random.jl:602
To resolve the ambiguity, try making one of the methods more specific, or adding a new method more specific than any of the existing applicable methods.

Stacktrace:
 [1] top-level scope
   @ REPL[20]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions