Skip to content

Commit

Permalink
Fix index access to new OneHotArray
Browse files Browse the repository at this point in the history
  • Loading branch information
darsnack committed Jun 15, 2021
1 parent a52d343 commit e42a0d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/onehot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ for wrapper in [:Adjoint, :Transpose]
size(A, 2) == L ||
throw(DimensionMismatch("Matrix column must correspond with OneHot size: $(size(A, 2)) != $L"))

return A[:, b.ix]
return A[:, onecold(b)]
end

function Base.:*(A::$wrapper{<:Number, <:AbstractVector{T}}, b::OneHotVector{<:Any, L}) where {L, T}
size(A, 2) == L ||
throw(DimensionMismatch("Matrix column must correspond with OneHot size: $(size(A, 2)) != $L"))

return A[b.ix]
return A[onecold(b)]
end
end
end

0 comments on commit e42a0d5

Please sign in to comment.