Skip to content

batchindex, batch and batchseq #387

@Proyag

Description

@Proyag

Even the examples in the documentation don't work for these functions.

julia> Flux.batch([[1,2,3],[4,5,6]])
ERROR: UndefVarError: indices not defined
Stacktrace:
 [1] batchindex(::Array{Int64,2}, ::Int64) at /home/ppal/.julia/packages/Flux/uUcYO/src/utils.jl:27
 [2] batch(::Array{Array{Int64,1},1}) at /home/ppal/.julia/packages/Flux/uUcYO/src/utils.jl:71
 [3] top-level scope at none:0

Changing indices to axes in the batchindex function fixed this,
but after that

julia> Flux.batchseq([[1,2,3],[4,5]], 0)
ERROR: MethodError: no method matching Array{Int64,1}(::Int64)
Closest candidates are:
  Array{Int64,1}() where T at boot.jl:413
  Array{Int64,1}(::UndefInitializer, ::Int64) where T at boot.jl:394
  Array{Int64,1}(::UndefInitializer, ::Int64...) where {T, N} at boot.jl:400
  ...
Stacktrace:
 [1] batch(::Array{Int64,1}) at /home/ppal/.julia/packages/Flux/uUcYO/src/utils.jl:67
 [2] (::getfield(Flux, Symbol("##4#7")){Array{Array{Int64,1},1}})(::Int64) at ./none:0
 [3] iterate at ./generator.jl:47 [inlined]
 [4] collect at ./array.jl:619 [inlined]
 [5] batchseq at /home/ppal/.julia/packages/Flux/uUcYO/src/utils.jl:94 [inlined]
 [6] batchseq(::Array{Array{Int64,1},1}, ::Int64) at /home/ppal/.julia/packages/Flux/uUcYO/src/utils.jl:93
 [7] top-level scope at none:0

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