Open
Description
Sometimes, the simulators may return larger arrays than we want to use in our networks, so it would be great to have some subsetting adapter transforms.
We need:
- Subsetting within an axis (taking only some elements) while keeping the number of axes the same. This is essentially the
np.take
functionality so we might want to call this transformtake
. In contrast tonp.take
, I would makeaxis
a mandatory arguments or default it to the last axis. Example:adapter.take("x", 1:3, axis = -1)
- Subsetting using a random set of indices (of user-specified size) within an axis. We might call this
subsample
. Internally it would calltake
after sampling the indices. Example:adapter.subsample("x", size = 3, axis = -1)
- Removing an axis of length one. Following numpy, I would call this transform
squeeze
: Example:adapter.squeeze("x", axis = 1)