RecursiveArrayTools.jl icon indicating copy to clipboard operation
RecursiveArrayTools.jl copied to clipboard

Convert VectorOfArray to Array when the size of the last dimension of each Array varies

Open msainsburydale opened this issue 3 years ago • 1 comments

Hi,

Thanks for the module, very nice. I was wondering if there's a way to convert an object of type VectorOfArray to Array when the size of the last dimension of each Array varies? Please see the MWE below.

v = VectorOfArray([rand(3, 2), rand(3, 2)])
convert(Array, v) # perfect

v = VectorOfArray([rand(3, 2), rand(3, 4)])
convert(Array, v) # want cat(v..., dims = 2)

Thanks in advance for any suggestions.

(If relevant, my need comes from the fact that, in Flux.jl, the last dimension of an Array corresponds to the observation dimension, and I have a variable number of observations in each Array.)

msainsburydale avatar Jun 01 '22 05:06 msainsburydale

No, an array cannot be ragged sized.

ChrisRackauckas avatar Jun 03 '22 00:06 ChrisRackauckas