Skip to content

Not every OneHotVector isa OneHotVector #57

@mcabbott

Description

@mcabbott

This y is a little odd. Is the problem just that show lies about its type, or that the alias OneHotVector is overly specific?

julia> x = onehotbatch(fill(2), 1:3)
3-element OneHotVector(::UInt32) with eltype Bool:
 
 1
 

julia> x isa OneHotVector  # no problem!
true

julia> dump(x)
OneHotVector{UInt32}
  indices: UInt32 0x00000002
  nlabels: Int64 3

julia> y = OneHotArray(fill(2), 3)
3-element OneHotVector(::Array{Int64, 0}) with eltype Bool:
 
 1
 

julia> y isa OneHotVector  # problem?
false

julia> dump(y)  # has mutable storage
OneHotArray{Int64, 0, 1, Array{Int64, 0}}
  indices: Array{Int64}(()) fill(2)
  nlabels: Int64 3

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