Skip to content

Commit 7cd2789

Browse files
put name before keyword-only argument (#74613)
1 parent 28c0f43 commit 7cd2789

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

python/paddle/tensor/creation.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,10 +1045,10 @@ def full_like(
10451045
x: paddle.Tensor,
10461046
fill_value: bool | float,
10471047
dtype: DTypeLike | None = None,
1048+
name: str | None = None,
10481049
*,
10491050
device: PlaceLike | None = None,
10501051
requires_grad: bool = False,
1051-
name: str | None = None,
10521052
) -> paddle.Tensor:
10531053
"""
10541054
@@ -1061,11 +1061,11 @@ def full_like(
10611061
dtype(np.dtype|str, optional): The data type of output. The data type can be one
10621062
of bool, float16, float32, float64, int32, int64. The default value is None, which means the output
10631063
data type is the same as input.
1064+
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
10641065
device(PlaceLike|None, optional): The desired device of returned tensor.
10651066
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
10661067
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
10671068
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
1068-
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
10691069
10701070
Returns:
10711071
Tensor: Tensor which is created according to ``x``, ``fill_value`` and ``dtype``.
@@ -1270,11 +1270,11 @@ def fill_constant(
12701270
def ones(
12711271
shape: ShapeLike,
12721272
dtype: DTypeLike | None = None,
1273+
name: str | None = None,
12731274
*,
12741275
out: paddle.Tensor | None = None,
12751276
device: PlaceLike | None = None,
12761277
requires_grad: bool = False,
1277-
name: str | None = None,
12781278
) -> paddle.Tensor:
12791279
"""
12801280
Create a Tensor of specified :attr:`shape` and :attr:`dtype` and fill it with 1.
@@ -1285,12 +1285,12 @@ def ones(
12851285
If ``shape`` is an Tensor, it should be an 1-D Tensor which represents a list.
12861286
dtype (np.dtype|str, optional): Data type of output Tensor, it should be one of
12871287
bool, float16, float32, float64, int32 and int64. If it is set to None, the data type will be float32.
1288+
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
12881289
out(Tensor, optional): The output tensor.
12891290
device(PlaceLike|None, optional): The desired device of returned tensor.
12901291
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
12911292
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
12921293
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
1293-
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
12941294
12951295
Returns:
12961296
Tensor: A Tensor of data type :attr:`dtype` with shape :attr:`shape` and all elements are 1.
@@ -1338,10 +1338,10 @@ def ones(
13381338
def ones_like(
13391339
x: paddle.Tensor,
13401340
dtype: DTypeLike | None = None,
1341+
name: str | None = None,
13411342
*,
13421343
device: PlaceLike | None = None,
13431344
requires_grad: bool = False,
1344-
name: str | None = None,
13451345
) -> paddle.Tensor:
13461346
"""
13471347
Returns a Tensor filled with the value 1, with the same shape and
@@ -1354,11 +1354,11 @@ def ones_like(
13541354
output tensor. Supported data types: bool, float16, float32, float64,
13551355
int32, int64. If ``dtype`` is None, the data type is the same as ``x``.
13561356
Default is None.
1357+
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
13571358
device(PlaceLike|None, optional): The desired device of returned tensor.
13581359
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
13591360
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
13601361
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
1361-
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
13621362
13631363
Returns:
13641364
Tensor: A Tensor filled with the value 1, with the same shape and
@@ -1392,11 +1392,11 @@ def ones_like(
13921392
def zeros(
13931393
shape: ShapeLike,
13941394
dtype: DTypeLike | None = None,
1395+
name: str | None = None,
13951396
*,
13961397
out: paddle.Tensor | None = None,
13971398
device: PlaceLike | None = None,
13981399
requires_grad: bool = False,
1399-
name: str | None = None,
14001400
) -> paddle.Tensor:
14011401
"""
14021402
Creates a tensor of specified :attr:`shape` and :attr:`dtype`, and fills it with 0.
@@ -1461,10 +1461,10 @@ def zeros(
14611461
def zeros_like(
14621462
x: paddle.Tensor,
14631463
dtype: DTypeLike | None = None,
1464+
name: str | None = None,
14641465
*,
14651466
device: PlaceLike | None = None,
14661467
requires_grad: bool = False,
1467-
name: str | None = None,
14681468
) -> paddle.Tensor:
14691469
"""
14701470
Returns a Tensor filled with the value 0, with the same shape and
@@ -1482,11 +1482,11 @@ def zeros_like(
14821482
output tensor. Supported data types: bool, float16, float32, float64,
14831483
int32, int64. If ``dtype`` is None, the data type is the same as ``x``.
14841484
Default is None.
1485+
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
14851486
device(PlaceLike|None, optional): The desired device of returned tensor.
14861487
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
14871488
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
14881489
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
1489-
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
14901490
14911491
Returns:
14921492
Tensor: A Tensor filled with the value 0, with the same shape and
@@ -1521,11 +1521,11 @@ def eye(
15211521
num_rows: int,
15221522
num_columns: int | None = None,
15231523
dtype: DTypeLike | None = None,
1524+
name: str | None = None,
15241525
*,
15251526
out: paddle.Tensor | None = None,
15261527
device: PlaceLike | None = None,
15271528
requires_grad: bool = False,
1528-
name: str | None = None,
15291529
) -> paddle.Tensor:
15301530
"""
15311531
@@ -1538,12 +1538,12 @@ def eye(
15381538
dtype(np.dtype|str, optional): The data type of the returned Tensor.
15391539
It should be int32, int64, float16, float32, float64, complex64, complex128. Default: if None, the data type
15401540
is float32.
1541+
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
15411542
out(Tensor, optional): The output tensor.
15421543
device(PlaceLike|None, optional): The desired device of returned tensor.
15431544
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
15441545
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
15451546
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
1546-
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
15471547
15481548
Returns:
15491549
Tensor: An identity Tensor or DenseTensor of shape [num_rows, num_columns].
@@ -1637,11 +1637,11 @@ def full(
16371637
shape: ShapeLike,
16381638
fill_value: bool | float | paddle.Tensor,
16391639
dtype: DTypeLike | None = None,
1640+
name: str | None = None,
16401641
*,
16411642
out: paddle.Tensor | None = None,
16421643
device: PlaceLike | None = None,
16431644
requires_grad: bool = False,
1644-
name: str | None = None,
16451645
) -> paddle.Tensor:
16461646
"""
16471647
@@ -1661,12 +1661,12 @@ def full(
16611661
dtype(np.dtype|str, optional): Data type of the output Tensor
16621662
which can be float16, float32, float64, int32, int64, if dtype is `None`, the data
16631663
type of created Tensor is `float32`.
1664+
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
16641665
out(Tensor, optional): The output tensor.
16651666
device(PlaceLike|None, optional): The desired device of returned tensor.
16661667
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
16671668
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
16681669
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
1669-
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
16701670
16711671
Returns:
16721672
Tensor: Tensor which is created according to ``shape``, ``fill_value`` and ``dtype``.
@@ -2642,11 +2642,11 @@ def diag(
26422642
def empty(
26432643
shape: ShapeLike,
26442644
dtype: DTypeLike | None = None,
2645+
name: str | None = None,
26452646
*,
26462647
out: paddle.Tensor | None = None,
26472648
device: PlaceLike | None = None,
26482649
requires_grad: bool = False,
2649-
name: str | None = None,
26502650
) -> paddle.Tensor:
26512651
"""
26522652
Returns a Tensor with uninitialized data which size is same as ``shape``.
@@ -2659,12 +2659,12 @@ def empty(
26592659
which can be bool, float16, float32, float64, int32, int64, complex64, complex128 if dtype is `None`, the data
26602660
type of created Tensor use global default dtype (see ``get_default_dtype``
26612661
for details).
2662+
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
26622663
out(Tensor, optional): The output tensor.
26632664
device(PlaceLike|None, optional): The desired device of returned tensor.
26642665
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
26652666
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
26662667
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
2667-
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
26682668
26692669
Returns:
26702670
Tensor: Tensor which is created according to ``shape`` and ``dtype``, and is uninitialized.
@@ -2804,10 +2804,10 @@ def empty(
28042804
def empty_like(
28052805
x: paddle.Tensor,
28062806
dtype: DTypeLike | None = None,
2807+
name: str | None = None,
28072808
*,
28082809
device: PlaceLike | None = None,
28092810
requires_grad: bool = False,
2810-
name: str | None = None,
28112811
) -> paddle.Tensor:
28122812
"""
28132813
Returns a Tensor with uninitialized data which has identical shape of ``x`` and ``dtype``.
@@ -2823,11 +2823,11 @@ def empty_like(
28232823
dtype(np.dtype|str, optional): The data type of output. The data type can be one
28242824
of bool, float16, float32, float64, int32, int64. The default value is None, which means the output
28252825
data type is the same as input.
2826+
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
28262827
device(PlaceLike|None, optional): The desired device of returned tensor.
28272828
if None, uses the current device for the default tensor type (see paddle.device.set_device()).
28282829
device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. Default: None.
28292830
requires_grad(bool, optional): If autograd should record operations on the returned tensor. Default: False.
2830-
name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
28312831
28322832
Returns:
28332833
Tensor: Tensor which is created according to ``x`` and ``dtype``, and is uninitialized.

0 commit comments

Comments
 (0)