stack function
Stacks a list of rank-R variables into one rank-(R+1) variable.
Packs the list of variables in values into a ariable with rank one higher than each variable in values,
by packing them along the axis dimension.
Given a list of length N of variables of shape (A, B, C); if axis == 0 then the output variable will have the shape (N, A, B, C). if axis == 1 then the output variable will have the shape (A, N, B, C). Etc.
Args:
- values: A list of variable objects with the same shape and type.
- axis: An int. The axis to stack along. Defaults to the first dimension. Negative values wrap around, so the valid range is [-(R+1), R+1).
Returns:
- output: A stacked variable with the same type as
values.
Implementation
VARP stack(List<VARP> values, {int axis = 0}) {
final pVec = values.toNativeVec();
final rval = VARP.fromPointer(C.mnn_expr_Stack(pVec.ptr, axis));
pVec.dispose();
return rval;
}