Skip to content

broken inferred tests for stack and batch #52

@CarloLucibello

Description

@CarloLucibello
julia> using MLUtils, Test

julia> x = [[1,2,3], [4,5,6]]
2-element Vector{Vector{Int64}}:
 [1, 2, 3]
 [4, 5, 6]

julia> @inferred batch(x)
ERROR: return type Matrix{Int64} does not match inferred return type Any
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] top-level scope
   @ REPL[4]:1

julia> @inferred stack(x; dims=1)
ERROR: return type Matrix{Int64} does not match inferred return type Any
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] top-level scope
   @ REPL[5]:1

The problem could be due to a brodcasted call to unsqueeze, on which stack relies:

julia> @inferred unsqueeze(x[1]; dims=1)
1×3 Matrix{Int64}:
 1  2  3

julia> f() = unsqueeze.(x; dims=1)
f (generic function with 1 method)

julia> @inferred f()
ERROR: return type Vector{Matrix{Int64}} does not match inferred return type Any
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] top-level scope
   @ REPL[13]:1
``

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