Skip to content

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

torch/functional.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ def atleast_1d(*tensors):
15221522
Input tensors with one or more dimensions are returned as-is.
15231523
15241524
Args:
1525-
input (Tensor or list of Tensors)
1525+
input (Tensor or sequence of Tensors): tensor(s) to be converted to at least 1-dimensional.
15261526
15271527
Returns:
15281528
output (Tensor or tuple of Tensors)
@@ -1543,6 +1543,8 @@ def atleast_1d(*tensors):
15431543
>>> y = torch.tensor(1.)
15441544
>>> torch.atleast_1d((x, y))
15451545
(tensor([0.5000]), tensor([1.]))
1546+
>>> torch.atleast_1d()
1547+
()
15461548
"""
15471549
# This wrapper exists to support variadic args.
15481550
if has_torch_function(tensors):
@@ -1558,7 +1560,7 @@ def atleast_2d(*tensors):
15581560
Input tensors with two or more dimensions are returned as-is.
15591561
15601562
Args:
1561-
input (Tensor or list of Tensors)
1563+
input (Tensor or sequence of Tensors): tensor(s) to be converted to at least 2-dimensional.
15621564
15631565
Returns:
15641566
output (Tensor or tuple of Tensors)
@@ -1581,6 +1583,8 @@ def atleast_2d(*tensors):
15811583
>>> y = torch.tensor(1.)
15821584
>>> torch.atleast_2d((x, y))
15831585
(tensor([[0.5000]]), tensor([[1.]]))
1586+
>>> torch.atleast_2d()
1587+
()
15841588
"""
15851589
# This wrapper exists to support variadic args.
15861590
if has_torch_function(tensors):
@@ -1596,7 +1600,7 @@ def atleast_3d(*tensors):
15961600
Input tensors with three or more dimensions are returned as-is.
15971601
15981602
Args:
1599-
input (Tensor or list of Tensors)
1603+
input (Tensor or sequence of Tensors): tensor(s) to be converted to at least 3-dimensional.
16001604
16011605
Returns:
16021606
output (Tensor or tuple of Tensors)
@@ -1627,6 +1631,8 @@ def atleast_3d(*tensors):
16271631
>>> y = torch.tensor(1.0)
16281632
>>> torch.atleast_3d((x, y))
16291633
(tensor([[[0.5000]]]), tensor([[[1.]]]))
1634+
>>> torch.atleast_3d()
1635+
()
16301636
"""
16311637
# This wrapper exists to support variadic args.
16321638
if has_torch_function(tensors):

0 commit comments

Comments
 (0)