oneflow.vstack

oneflow.vstack(tensors)Tensor

Stack tensors in tensors vertically (row wise).

This is equivalent to concatenation tensors in tensors along 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.vstack.html.

Parameters

tensors – (List[oneflow.Tensor]): sequence of tensors to stack

Returns

A Tensor

For example:

>>> 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])