unstack function
Unpacks the given dimension of a rank-R tensor into rank-(R-1) variable.
For example, given a variable of shape (A, B, C, D);
If axis == 0 then the i'th variable in output is the slice valuei, :, :, : and each variable in output will have shape (B, C, D).
(Note that the dimension unpacked along is gone, unlike split).
If axis == 1 then the i'th variable in output is the slice value, i, :, and each variable in output will have shape (A, C, D).
Args:
- value: A rank R > 0 variable to be unstacked.
- num: An int. The length of the dimension axis. Automatically inferred if None (the default).
- axis: An int. The axis to unstack along. Defaults to the first dimension. Negative values wrap around, so the valid range is [-R, R).
Returns:
- The list of variable objects unstacked from value.
Implementation
List<VARP> unstack(VARP input, {int axis = 0}) {
final vec = VecVARP.fromPointer(C.mnn_expr_Unstack(input.ptr, axis));
final rval = vec.toList();
vec.dispose();
return rval;
}