SciML / SciML/RecursiveArrayTools.jl

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

Open
#208 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
233
Forks
76
Avg merge
2h 17m
Merged PRs (30d)
9

Description

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.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the MWE with VectorOfArray and inspect the conversion entry point in RecursiveArrayTools.jl. The change is done when arrays with equal last dimensions retain current conversion behavior and arrays with varying last dimensions are concatenated along dims = 2, with tests covering both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.