Skip to content

onecold does not work on CuMatrix #864

@AzamatB

Description

@AzamatB
julia> xs = rand(2,3)
2×3 Array{Float64,2}:
 0.0758553  0.779633    0.218497
 0.840066   0.00234058  0.402085

julia> Flux.onecold(xs, ["a","b"])
3-element Array{String,1}:
 "b"
 "a"
 "b"

julia> xs = cu(xs)
2×3 CuArray{Float32,2}:
 0.0758553  0.779633    0.218497
 0.840066   0.00234058  0.402085

julia> Flux.onecold(xs, ["a","b"])
ERROR: Type String does not have a definite size.
Stacktrace:
 [1] sizeof at ./essentials.jl:452 [inlined]
 [2] CuArray{String,1}(::UndefInitializer, ::Tuple{Int64}) at /home/azamat/.julia/packages/CuArrays/wXQp8/src/array.jl:38
 [3] similar at /home/azamat/.julia/packages/CuArrays/wXQp8/src/array.jl:69 [inlined]
 [4] similar(::CuArray{Float32,1}, ::Type{String}, ::Tuple{Base.OneTo{Int64}}) at ./abstractarray.jl:635
 [5] #mapslices#111(::Int64, ::typeof(mapslices), ::getfield(Flux, Symbol("##25#26")){Tuple{Array{String,1}}}, ::CuArray{Float32,2}) at ./abstractarray.jl:2009
 [6] #mapslices at ./none:0 [inlined]
 [7] onecold(::CuArray{Float32,2}, ::Array{String,1}) at /home/azamat/.julia/packages/Flux/dkJUV/src/onehot.jl:121
 [8] top-level scope at none:0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions