You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- 3. Given a 3-D tensor x with a shape [2, 4, 6], and the target shape is [-1, 0, 3, 2], the reshape operator will transform x into a 4-D tensor with shape [2, 4, 3, 2] and leaving x's data unchanged. In this case, besides -1, 0 means the actual dimension value is going to be copied from the corresponding dimension of x.
907
907
908
+
.. note::
909
+
Alias Support: The parameter name ``input`` can be used as an alias for ``x``.
910
+
For example, ``reshape(input=tensor_x, ...)`` is equivalent to ``reshape(x=tensor_x, ...)``.
911
+
908
912
Args:
909
913
x (Tensor): The input sparse tensor with data type ``float32``, ``float64``, ``int32``, ``int64`` or ``bool``.
910
914
shape (list|tuple): Define the target shape. At most one dimension of the target shape can be -1.
Alias Support: The parameter name ``input`` can be used as an alias for ``x``, and ``dim`` can be used as an alias for ``axis``.
6485
+
For example, ``repeat_interleave(input=tensor_x, dim=1, ...)`` is equivalent to ``repeat_interleave(x=tensor_x, axis=1, ...)``.
6470
6486
6471
6487
Args:
6472
6488
x (Tensor): The input Tensor to be operated. The data of ``x`` can be one of float32, float64, int32, int64.
6489
+
alias: ``input``.
6473
6490
repeats (Tensor|int): The number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis.
6474
6491
axis (int|None, optional): The dimension in which we manipulate. Default: None, the output tensor is flatten.
6492
+
alias: ``dim``.
6475
6493
name(str|None, optional): The default value is None. Normally there is no
6476
6494
need for user to set this property. For more information, please
6477
6495
refer to :ref:`api_guide_Name`.
@@ -6855,12 +6873,18 @@ def take_along_axis(
6855
6873
"""
6856
6874
Take values from the input array by given indices matrix along the designated axis.
6857
6875
6876
+
.. note::
6877
+
Alias Support: The parameter name ``input`` can be used as an alias for ``arr``, and ``dim`` can be used as an alias for ``axis``.
6878
+
For example, ``repeat_interleave(input=tensor_arr, dim=1, ...)`` is equivalent to ``repeat_interleave(arr=tensor_arr, axis=1, ...)``.
6879
+
6858
6880
Args:
6859
6881
arr (Tensor) : The input Tensor. Supported data types are bfloat16, float16, float32, float64,
6860
6882
int32, int64, uint8.
6883
+
alias: ``input``.
6861
6884
indices (Tensor) : Indices to take along each 1d slice of arr. This must match the dimension of arr,
6862
6885
and need to broadcast against arr. Supported data type are int32 and int64.
6863
6886
axis (int) : The axis to take 1d slices along.
6887
+
alias: ``dim``.
6864
6888
broadcast (bool, optional): whether the indices broadcast.
6865
6889
6866
6890
Returns:
@@ -7564,9 +7588,19 @@ def view(
7564
7588
Note that the output Tensor will share data with origin Tensor and doesn't
7565
7589
have a Tensor copy in ``dygraph`` mode.
7566
7590
7591
+
.. note::
7592
+
Alias Support: The parameter name ``size`` and ``dtype`` can be used as an alias for ``shape_or_dtype``.
7593
+
``shape_or_dtype`` can be a variable number of arguments.
7594
+
For example:
7595
+
``tensor_x.view(dtype=paddle.float32)``
7596
+
``tensor_x.view(size=[-1, 1, 3])``
7597
+
``tensor_x.view(-1, 1, 3)``
7598
+
7567
7599
Args:
7568
7600
x (Tensor): An N-D Tensor. The data type is ``float32``, ``float64``, ``int32``, ``int64`` or ``bool``
7569
-
shape_or_dtype (list|tuple|np.dtype|str|VarType): Define the target shape or dtype. If list or tuple, shape_or_dtype represents shape, each element of it should be integer. If np.dtype or str or VarType, shape_or_dtype represents dtype, it can be bool, float16, float32, float64, int8, int32, int64, uint8.
7601
+
shape_or_dtype (list|tuple|np.dtype|str|VarType|variable number of arguments): Define the target shape or dtype. If list or tuple, shape_or_dtype represents shape, each element of it should be integer. If np.dtype or str or VarType, shape_or_dtype represents dtype, it can be bool, float16, float32, float64, int8, int32, int64, uint8.
7602
+
``shape_or_dtype`` can be a variable number of arguments.
7603
+
alias: ``size`` or ``dtype``.
7570
7604
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Copy file name to clipboardExpand all lines: python/paddle/tensor/stat.py
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -164,9 +164,15 @@ def var(
164
164
"""
165
165
Computes the variance of ``x`` along ``axis`` .
166
166
167
+
.. note::
168
+
Alias Support: The parameter name ``input`` can be used as an alias for ``x``, and ``dim`` can be used as an alias for ``axis``.
169
+
For example, ``var(input=tensor_x, dim=1, ...)`` is equivalent to ``var(x=tensor_x, axis=1, ...)``.
170
+
167
171
Args:
168
172
x (Tensor): The input Tensor with data type float16, float32, float64.
173
+
alias: ``input``.
169
174
axis (int|list|tuple|None, optional): The axis along which to perform variance calculations. ``axis`` should be int, list(int) or tuple(int).
175
+
alias: ``dim``.
170
176
171
177
- If ``axis`` is a list/tuple of dimension(s), variance is calculated along all element(s) of ``axis`` . ``axis`` or element(s) of ``axis`` should be in range [-D, D), where D is the dimensions of ``x`` .
172
178
- If ``axis`` or element(s) of ``axis`` is less than 0, it works the same way as :math:`axis + D` .
@@ -506,9 +512,16 @@ def median(
506
512
"""
507
513
Compute the median along the specified axis.
508
514
515
+
.. note::
516
+
Alias Support: The parameter name ``input`` can be used as an alias for ``x``, and ``dim`` can be used as an alias for ``axis``.
517
+
When an alias replacement occurs, the default parameter for mode setting is min instead of avg.
518
+
For example, ``median(input=tensor_x, dim=1, ...)`` is equivalent to ``median(x=tensor_x, axis=1, ...)``.
519
+
509
520
Args:
510
521
x (Tensor): The input Tensor, it's data type can be bfloat16, float16, float32, float64, int32, int64.
522
+
alias: ``input``.
511
523
axis (int|None, optional): The axis along which to perform median calculations ``axis`` should be int.
524
+
alias: ``dim``.
512
525
``axis`` should be in range [-D, D), where D is the dimensions of ``x`` .
513
526
If ``axis`` is less than 0, it works the same way as :math:`axis + D`.
514
527
If ``axis`` is None, median is calculated over all elements of ``x``. Default is None.
@@ -520,6 +533,7 @@ def median(
520
533
mode (str, optional): Whether to use mean or min operation to calculate
521
534
the median values when the input tensor has an even number of elements
522
535
in the dimension ``axis``. Support 'avg' and 'min'. Default is 'avg'.
536
+
When an alias replacement occurs, the default parameter for mode setting is min instead of avg.
523
537
name (str|None, optional): Name for the operation (optional, default is None).
524
538
For more information, please refer to :ref:`api_guide_Name`.
0 commit comments