Skip to content

Array(chn) drops third dimension for nchain==1 #429

Closed
@bgctw

Description

@bgctw

This behavior of Array(chn) dropping the third dimension when only a single chain is present was unexpected to me. Is it meant to be this way?
It breaks code that uses mapslices on the Array over the third dimension, e.g. for computing an output for each sample, that does not check the special case of only a single chain before.

Minimal working example:

chn2 = Chains(rand(3, 2, 1), [:a, :b]); 
size(chn2)                  # 3-dimensional
size(Array(chn2))       # only 2-dimensional

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