Skip to content

getindex(::Tensor, i::Int) throws AssertionError #775

@jpsamaroo

Description

@jpsamaroo

On Finch 1.2.9, the following occurs:

julia> using Finch

julia> A = fsprand(4, 4, 0.5);

julia> A[1]
ERROR: AssertionError: ndims(arr) == length(inds)
Stacktrace:
 [1] macro expansion
   @ ~/.julia/packages/Finch/tUiDI/src/interface/index.jl:78 [inlined]
 [2] var"##getindex_helper_generator#265"(arr::Type, inds::Type)
   @ Finch ~/.julia/packages/Finch/tUiDI/src/util/staging.jl:32
 [3] (::Finch.var"#1822#1828"{DataType, DataType})()
   @ Finch ~/.julia/packages/Finch/tUiDI/src/util/staging.jl:65
 [4] #s364#1821
   @ ~/.julia/packages/Finch/tUiDI/src/util/staging.jl:74 [inlined]
 [5] var"#s364#1821"(::Any, arr::Any, inds::Any)
   @ Finch ./none:0
 [6] (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any})
   @ Core ./boot.jl:707
 [7] getindex(arr::Tensor{SparseCOOLevel{2, Tuple{Int64, Int64}, Vector{Int64}, Tuple{Vector{…}, Vector{…}}, ElementLevel{0.0, Float64, Int64, Vector{…}}}}, inds::Int64)
   @ Finch ~/.julia/packages/Finch/tUiDI/src/interface/index.jl:52
 [8] top-level scope
   @ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types.

While linear indexing may not be an efficient way to access a Tensor, it's convenient to have for generic code (even though Tensor is not an AbstractArray).

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