Skip to content

Commit ba6f65c

Browse files
kianasunfacebook-github-bot
authored andcommitted
Add document of functions nn.init.ones_/zeros_ (#23145)
Summary: Functions `nn.init.ones_` and `nn.init.zeros_` were not documented. As mentioned in #9886 Pull Request resolved: #23145 Differential Revision: D16427108 Pulled By: soumith fbshipit-source-id: 4fac31e79717a436411ef5e107a829b403e576c9
1 parent 2527102 commit ba6f65c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/source/nn.init.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ torch.nn.init
99
.. autofunction:: uniform_
1010
.. autofunction:: normal_
1111
.. autofunction:: constant_
12+
.. autofunction:: ones_
13+
.. autofunction:: zeros_
1214
.. autofunction:: eye_
1315
.. autofunction:: dirac_
1416
.. autofunction:: xavier_uniform_

torch/nn/init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def constant_(tensor, val):
122122

123123
def ones_(tensor):
124124
# type: (Tensor) -> Tensor
125-
r"""Fills the input Tensor with ones`.
125+
r"""Fills the input Tensor with the scalar value `1`.
126126
127127
Args:
128128
tensor: an n-dimensional `torch.Tensor`
@@ -136,7 +136,7 @@ def ones_(tensor):
136136

137137
def zeros_(tensor):
138138
# type: (Tensor) -> Tensor
139-
r"""Fills the input Tensor with zeros`.
139+
r"""Fills the input Tensor with the scalar value `0`.
140140
141141
Args:
142142
tensor: an n-dimensional `torch.Tensor`

0 commit comments

Comments
 (0)