Skip to content

Unable to infer ranges for indices i, in deeply nested r[k][j][i] #76

@tpapp

Description

@tpapp

Consider the MWE:

using TensorCast # 0.4.8

r = fill(fill(ones(3), 5), 7)

function f(r)
    @cast _[i, j  k] := r[k].a[j][i]
end

Ideally f(r) should give a 3 x 35 matrix, but I get

ERROR: LoadError: unable to infer ranges for indices i
    @cast _[i, j  k] := ((r[k]).a[j])[i]  
    @ Main REPL[22]:2
Stacktrace:
 [1] sizeinfer(store::@NamedTuple{dict::Dict{Any, Any}, assert::Vector{Any}, mustassert::Vector{Any}, seen::Vector{Any}, need::Vector{Any}, top::Vector{Any}, main::Vector{Any}}, call::TensorCast.CallInfo)
   @ TensorCast ~/.julia/packages/TensorCast/fctFg/src/macro.jl:1143
 [2] findsizes(store::@NamedTuple{dict::Dict{Any, Any}, assert::Vector{Any}, mustassert::Vector{Any}, seen::Vector{Any}, need::Vector{Any}, top::Vector{Any}, main::Vector{Any}}, call::TensorCast.CallInfo)
   @ TensorCast ~/.julia/packages/TensorCast/fctFg/src/macro.jl:1092
 [3] _macro(exone::Expr, extwo::Nothing, exthree::Nothing; call::TensorCast.CallInfo, dict::Dict{Any, Any})
   @ TensorCast ~/.julia/packages/TensorCast/fctFg/src/macro.jl:211
 [4] _macro
   @ ~/.julia/packages/TensorCast/fctFg/src/macro.jl:154 [inlined]
 [5] var"@cast"(__source__::LineNumberNode, __module__::Module, exs::Vararg{Any})
   @ TensorCast ~/.julia/packages/TensorCast/fctFg/src/macro.jl:74
in expression starting at REPL[22]:2

Is it possible to make this work somehow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions