Skip to content

Ambiguity in getindex, and missing == definition? #28

Open
@mcabbott

Description

@mcabbott

The following error showed up in #27:

julia> y1 = onehotbatch([1, 3, 0, 2], 0:9);

julia> y1 == y1
true

julia> using JLArrays

julia> y2 = onehotbatch([1, 3, 0, 2] |> jl, 0:9)  # with #27
10×4 OneHotMatrix(::JLArray{UInt32, 1}) with eltype Bool:
     1  
 1      
       1
   1    
       
       
       
       
       
       

julia> jl(y1) == y2
ERROR: MethodError: getindex(::OneHotMatrix{UInt32, JLArray{UInt32, 1}}, ::Int64, ::Int64) is ambiguous.

Candidates:
  getindex(x::OneHotArray{<:Any, N, <:Any, <:GPUArraysCore.AbstractGPUArray}, i::Int64, I::Vararg{Any, N}) where N
    @ OneHotArrays ~/.julia/dev/OneHotArrays/src/array.jl:71
  getindex(x::OneHotArray{var"#s8", N, var"N+1", I} where {var"#s8", var"N+1", I<:Union{AbstractArray{var"#s8", N}, var"#s8"}}, i::Int64, I::Vararg{Int64, N}) where N
    @ OneHotArrays ~/.julia/dev/OneHotArrays/src/array.jl:65
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] _getindex
   @ ./abstractarray.jl:1344 [inlined]
 [2] getindex
   @ ./abstractarray.jl:1294 [inlined]
 [3] iterate
   @ ./abstractarray.jl:1220 [inlined]
 [4] iterate
   @ ./abstractarray.jl:1218 [inlined]
 [5] _zip_iterate_some
   @ ./iterators.jl:428 [inlined]
 [6] _zip_iterate_all
   @ ./iterators.jl:420 [inlined]
 [7] iterate
   @ ./iterators.jl:410 [inlined]
 [8] ==(A::OneHotMatrix{UInt32, JLArray{UInt32, 1}}, B::OneHotMatrix{UInt32, JLArray{UInt32, 1}})
   @ Base ./abstractarray.jl:2912
 [9] top-level scope
   @ REPL[34]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions