JuliaML / MLUtils.jl

Utilities and abstractions for Machine Learning tasks
MIT License
107 stars 20 forks source link

`batchseq` with vectors of vectors #140

Open mkschleg opened 1 year ago

mkschleg commented 1 year ago

Just working through my upgrade to Flux v0.13. I'm seeing a difference in batchseq's behavior. Specifically, in the Flux 0.12 batchseq I can do the following:

Flux.batchseq([[rand(3), rand(3), rand(3)], [rand(3), rand(3)]], zeros(3))

Would result in a sequence (of length 3) of matrices of size 3x2 where 3 is num features and 2 is the batch size. Now in MLUtils v0.4.0.

MLUtils.batchseq([[rand(3), rand(3), rand(3)], [rand(3), rand(3)]], zeros(3))

results in a sequence of vector of vectors. The documentation from MLUtils also isn’t helping at all here. Any ideas on how to get the previous behavior? Can’t find anything on the web. I can rewrite the function, but would rather use a more central function that can be tested.

After playing with the function, in this instance obsview in the MLUtils version results in a 0-dim view of the vector of vectors, and so when batching it just concats the vectors instead of stacking them. Once obsview is removed it reverts back to the old behavior. I'm happy to put in a fix, but obsview likely is used to cover another use case that I'm unaware of so am not sure where to focus effort.