fixed issue #20921 (#20922)
Summary:
For tensor creation ops like `torch.zeros` and `torch.ones`, the docs [0], [1] use `sizes` as the first argument to the function call while the correct argument is `size`. This is tested for pytorch 1.1 installed using pip on ubuntu 19.04
An example
```
>>> torch.zeros(2, 3)
tensor([[0., 0., 0.],
[0., 0., 0.]])
>>> torch.zeros(sizes = (2, 3))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: zeros() missing 1 required positional arguments: "size"
>>> torch.zeros(size = (2, 3))
tensor([[0., 0., 0.],
[0., 0., 0.]])
>>> torch.ones(sizes = (2, 3))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: ones() missing 1 required positional arguments: "size"
>>> torch.ones(size = (2, 3))
tensor([[1., 1., 1.],
[1., 1., 1.]])
```
[0]: https://pytorch.org/docs/master/torch.html#torch.zeros
[1]: https://pytorch.org/docs/master/torch.html#torch.ones
Pull Request resolved: https://github.com/pytorch/pytorch/pull/20922
Differential Revision: D15498741
Pulled By: mrshenli
fbshipit-source-id: 963324ffa004d62ca77ce30ed6f0c3932b5b79b7
diff --git a/torch/_torch_docs.py b/torch/_torch_docs.py
index 8683f34..34a3384 100644
--- a/torch/_torch_docs.py
+++ b/torch/_torch_docs.py
@@ -3583,13 +3583,13 @@
add_docstr(torch.ones,
r"""
-ones(*sizes, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor
+ones(*size, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor
Returns a tensor filled with the scalar value `1`, with the shape defined
by the variable argument :attr:`sizes`.
Args:
- sizes (int...): a sequence of integers defining the shape of the output tensor.
+ size (int...): a sequence of integers defining the shape of the output tensor.
Can be a variable number of arguments or a collection like a list or tuple.
{out}
{dtype}
@@ -5632,13 +5632,13 @@
add_docstr(torch.zeros,
r"""
-zeros(*sizes, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor
+zeros(*size, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor
Returns a tensor filled with the scalar value `0`, with the shape defined
by the variable argument :attr:`sizes`.
Args:
- sizes (int...): a sequence of integers defining the shape of the output tensor.
+ size (int...): a sequence of integers defining the shape of the output tensor.
Can be a variable number of arguments or a collection like a list or tuple.
{out}
{dtype}