row_stack(tensors) → Tensor¶
Stack tensors in
tensorsvertically (row wise).
This is equivalent to concatenation tensors in
tensorsalong the first axis.
When there are tensors with dimension less than 2, these tensors will be reshaped by
oneflow.atleast_2d()to 2-D tensors before stacking.
The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.row_stack.html.
tensors – (List[oneflow.Tensor]): sequence of tensors to stack
>>> import oneflow as flow >>> x1 = flow.randn(2, 5) >>> x2 = flow.randn(3, 5) >>> flow.vstack([x1, x2]).shape oneflow.Size([5, 5]) >>> x = flow.randn(5) >>> flow.vstack([x, x]).shape oneflow.Size([2, 5])