Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batchindex, batch and batchseq #387

Closed
Proyag opened this issue Sep 6, 2018 · 3 comments
Closed

batchindex, batch and batchseq #387

Proyag opened this issue Sep 6, 2018 · 3 comments

Comments

@Proyag
Copy link
Contributor

Proyag commented Sep 6, 2018

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
@Proyag
Copy link
Contributor Author

Proyag commented Sep 6, 2018

Related to #368 but unlike that one, I'm not getting any errors with batch after fixing the indices to axes.

@MikeInnes
Copy link
Member

Guess these got lost in the transition to 1.0. Would you be able to send a PR for the fixes you have?

For batchseq you probably just need to use Array{Int}(undef, N).

@Proyag
Copy link
Contributor Author

Proyag commented Sep 6, 2018

Thanks for the pointer. Hope #389 helps.

@Proyag Proyag closed this as completed Oct 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants