Skip to content
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
34 changes: 17 additions & 17 deletions python/paddle/tensor/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,10 +1045,10 @@ def full_like(
x: paddle.Tensor,
fill_value: bool | float,
dtype: DTypeLike | None = None,
name: str | None = None,
*,
device: PlaceLike | None = None,
requires_grad: bool = False,
name: str | None = None,
) -> paddle.Tensor:
"""

Expand All @@ -1061,11 +1061,11 @@ def full_like(
dtype(np.dtype|str, optional): The data type of output. The data type can be one
of bool, float16, float32, float64, int32, int64. The default value is None, which means the output
data type is the same as input.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
device(PlaceLike|None, optional): The desired device of returned tensor.
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
Tensor: Tensor which is created according to ``x``, ``fill_value`` and ``dtype``.
Expand Down Expand Up @@ -1270,11 +1270,11 @@ def fill_constant(
def ones(
shape: ShapeLike,
dtype: DTypeLike | None = None,
name: str | None = None,
*,
out: paddle.Tensor | None = None,
device: PlaceLike | None = None,
requires_grad: bool = False,
name: str | None = None,
) -> paddle.Tensor:
"""
Create a Tensor of specified :attr:`shape` and :attr:`dtype` and fill it with 1.
Expand All @@ -1285,12 +1285,12 @@ def ones(
If ``shape`` is an Tensor, it should be an 1-D Tensor which represents a list.
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|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
out(Tensor, optional): The output tensor.
device(PlaceLike|None, optional): The desired device of returned tensor.
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
name(str|None, 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 are 1.
Expand Down Expand Up @@ -1338,10 +1338,10 @@ def ones(
def ones_like(
x: paddle.Tensor,
dtype: DTypeLike | None = None,
name: str | None = None,
*,
device: PlaceLike | None = None,
requires_grad: bool = False,
name: str | None = None,
) -> paddle.Tensor:
"""
Returns a Tensor filled with the value 1, with the same shape and
Expand All @@ -1354,11 +1354,11 @@ def ones_like(
output tensor. Supported data types: bool, float16, float32, float64,
int32, int64. If ``dtype`` is None, the data type is the same as ``x``.
Default is None.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
device(PlaceLike|None, optional): The desired device of returned tensor.
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
Tensor: A Tensor filled with the value 1, with the same shape and
Expand Down Expand Up @@ -1392,11 +1392,11 @@ def ones_like(
def zeros(
shape: ShapeLike,
dtype: DTypeLike | None = None,
name: str | None = None,
*,
out: paddle.Tensor | None = None,
device: PlaceLike | None = None,
requires_grad: bool = False,
name: str | None = None,
) -> paddle.Tensor:
"""
Creates a tensor of specified :attr:`shape` and :attr:`dtype`, and fills it with 0.
Expand Down Expand Up @@ -1461,10 +1461,10 @@ def zeros(
def zeros_like(
x: paddle.Tensor,
dtype: DTypeLike | None = None,
name: str | None = None,
*,
device: PlaceLike | None = None,
requires_grad: bool = False,
name: str | None = None,
) -> paddle.Tensor:
"""
Returns a Tensor filled with the value 0, with the same shape and
Expand All @@ -1482,11 +1482,11 @@ def zeros_like(
output tensor. Supported data types: bool, float16, float32, float64,
int32, int64. If ``dtype`` is None, the data type is the same as ``x``.
Default is None.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
device(PlaceLike|None, optional): The desired device of returned tensor.
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
Tensor: A Tensor filled with the value 0, with the same shape and
Expand Down Expand Up @@ -1521,11 +1521,11 @@ def eye(
num_rows: int,
num_columns: int | None = None,
dtype: DTypeLike | None = None,
name: str | None = None,
*,
out: paddle.Tensor | None = None,
device: PlaceLike | None = None,
requires_grad: bool = False,
name: str | None = None,
) -> paddle.Tensor:
"""

Expand All @@ -1538,12 +1538,12 @@ def eye(
dtype(np.dtype|str, optional): The data type of the returned Tensor.
It should be int32, int64, float16, float32, float64, complex64, complex128. Default: if None, the data type
is float32.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
out(Tensor, optional): The output tensor.
device(PlaceLike|None, optional): The desired device of returned tensor.
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
Tensor: An identity Tensor or DenseTensor of shape [num_rows, num_columns].
Expand Down Expand Up @@ -1637,11 +1637,11 @@ def full(
shape: ShapeLike,
fill_value: bool | float | paddle.Tensor,
dtype: DTypeLike | None = None,
name: str | None = None,
*,
out: paddle.Tensor | None = None,
device: PlaceLike | None = None,
requires_grad: bool = False,
name: str | None = None,
) -> paddle.Tensor:
"""

Expand All @@ -1661,12 +1661,12 @@ def full(
dtype(np.dtype|str, optional): Data type of the output Tensor
which can be float16, float32, float64, int32, int64, if dtype is `None`, the data
type of created Tensor is `float32`.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
out(Tensor, optional): The output tensor.
device(PlaceLike|None, optional): The desired device of returned tensor.
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
Tensor: Tensor which is created according to ``shape``, ``fill_value`` and ``dtype``.
Expand Down Expand Up @@ -2626,11 +2626,11 @@ def diag(
def empty(
shape: ShapeLike,
dtype: DTypeLike | None = None,
name: str | None = None,
*,
out: paddle.Tensor | None = None,
device: PlaceLike | None = None,
requires_grad: bool = False,
name: str | None = None,
) -> paddle.Tensor:
"""
Returns a Tensor with uninitialized data which size is same as ``shape``.
Expand All @@ -2643,12 +2643,12 @@ def empty(
which can be bool, float16, float32, float64, int32, int64, complex64, complex128 if dtype is `None`, the data
type of created Tensor use global default dtype (see ``get_default_dtype``
for details).
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
out(Tensor, optional): The output tensor.
device(PlaceLike|None, optional): The desired device of returned tensor.
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
Tensor: Tensor which is created according to ``shape`` and ``dtype``, and is uninitialized.
Expand Down Expand Up @@ -2788,10 +2788,10 @@ def empty(
def empty_like(
x: paddle.Tensor,
dtype: DTypeLike | None = None,
name: str | None = None,
*,
device: PlaceLike | None = None,
requires_grad: bool = False,
name: str | None = None,
) -> paddle.Tensor:
"""
Returns a Tensor with uninitialized data which has identical shape of ``x`` and ``dtype``.
Expand All @@ -2807,11 +2807,11 @@ def empty_like(
dtype(np.dtype|str, optional): The data type of output. The data type can be one
of bool, float16, float32, float64, int32, int64. The default value is None, which means the output
data type is the same as input.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
device(PlaceLike|None, optional): The desired device of returned tensor.
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
Tensor: Tensor which is created according to ``x`` and ``dtype``, and is uninitialized.
Expand Down