atleast_1d(*tensors) → Tensor or List[Tensor]¶
Returns a 1-dimensional view of each input tensor with zero dimensions. Input tensors with one or more dimensions are returned as-is.
The interface is consistent with PyTorch.
The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.atleast_1d.html.
>>> import oneflow as flow >>> x = flow.randn(1) >>> flow.atleast_1d(x).shape oneflow.Size() >>> x = flow.tensor(0) >>> x.shape oneflow.Size() >>> flow.atleast_1d(x).shape oneflow.Size()