Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复 paddle.ones 文档 #42915

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions python/paddle/tensor/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,19 +483,20 @@ def full_like(x, fill_value, dtype=None, name=None):
def ones(shape, dtype=None, name=None):
"""

The OP creates a tensor of specified :attr:`shape` and :attr:`dtype`, and fills it with 1.
Create a Tensor of specified :attr:`shape` and :attr:`dtype` and fill it with 1.

Args:
shape(tuple|list|Tensor): Shape of the Tensor to be created, the data type of shape is int32 or int64.
dtype(np.dtype|str, optional): Data type of output Tensor, it supports
bool, float16, float32, float64, int32 and int64. Default: if None, the data type is 'float32'.
name(str, optional): The default value is None. Normally there is no need for user to set this property. For more information, please refer to :ref:`api_guide_Name`
shape (tuple|list|Tensor): Shape of the Tensor to be created, the data type of shape should be int32 or int64.
dtype (np.dtype|str, optional): Data type of output Tensor, it should be one of
bool, float16, float32, float64, int32 and int64. If it is set to None, the data type will be float32.
name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
Tensor: A tensor of data type :attr:`dtype` with shape :attr:`shape` and all elements set to 1.
Tensor: A Tensor of data type :attr:`dtype` with shape :attr:`shape` and all elements are 1.

Examples:
.. code-block:: python
:name: ones-example

import paddle

Expand Down