!37589 add chinese doc for erf/erfc, xlogy tensor functions
Merge pull request !37589 from cjh9368/static_check
This commit is contained in:
commit
803fc1aefc
|
@ -424,6 +424,32 @@ mindspore.Tensor
|
|||
- **TypeError** - axis不是int类型。
|
||||
- **ValueError** - axis的取值不在[-self.ndim - 1, self.ndim + 1)。
|
||||
|
||||
.. py:method:: erf()
|
||||
|
||||
逐元素计算原Tensor的高斯误差函数。
|
||||
更多细节参考 :func:`mindspore.ops.erf`。
|
||||
|
||||
**返回:**
|
||||
|
||||
Tensor,具有与原Tensor相同的数据类型和shape。
|
||||
|
||||
**异常:**
|
||||
|
||||
- **TypeError** - 原Tensor的数据类型既不是float16也不是float32。
|
||||
|
||||
.. py:method:: erfc()
|
||||
|
||||
逐元素计算原Tensor的互补误差函数。
|
||||
更多细节参考 :func:`mindspore.ops.erfc`。
|
||||
|
||||
**返回:**
|
||||
|
||||
Tensor,具有与原Tensor相同的数据类型和shape。
|
||||
|
||||
**异常:**
|
||||
|
||||
- **TypeError** - 原Tensor的数据类型既不是float16也不是float32。
|
||||
|
||||
.. py:method:: fill(value)
|
||||
|
||||
用标量值填充数组。
|
||||
|
@ -1813,3 +1839,28 @@ mindspore.Tensor
|
|||
|
||||
Tensor,具有与入参 `shape` 相同的维度。
|
||||
|
||||
.. py:method:: xlogy(y)
|
||||
|
||||
计算原Tensor乘以输入Tensor的对数。当原Tensor为零时,则返回零。原Tensor的数据类型需要是
|
||||
`number <https://www.mindspore.cn/docs/zh-CN/master/api_python/mindspore.html#mindspore.dtype>`_ 或
|
||||
`bool_ <https://www.mindspore.cn/docs/zh-CN/master/api_python/mindspore.html#mindspore.dtype>`_。
|
||||
后面为了使表达清晰,使用`x` 代替原Tensor。
|
||||
|
||||
.. math::
|
||||
out_i = x_{i}\ln{y_{i}}
|
||||
|
||||
`x` 和 `y` 的输入遵循隐式类型转换规则,使数据类型一致。输入必须是两个Tensor或一个Tensor和一个Scalar。当输入是两个Tensor时,它们的数据类型不能同时是bool的,它们的shape可以广播。当输入是一个Tensor和一个Scalar时,Scalar只能是一个常量。
|
||||
|
||||
**参数:**
|
||||
|
||||
- **y** (Union[Tensor, number.Number, bool]) - 第二个输入为数值型。当第一个输入是Tensor或数据类型为数值型或bool的Tensor时,则第二个输入是数值型或bool。当第一个输入是Scalar时,则第二个输入必须是数据类型为数值型或bool的Tensor。
|
||||
|
||||
**返回:**
|
||||
|
||||
Tensor,shape与广播后的shape相同,数据类型为两个输入中精度较高或数数值较高的类型。
|
||||
|
||||
**异常:**
|
||||
|
||||
- **TypeError** - 如果 `x` 和 `y` 不是数值型、bool或Tensor。
|
||||
- **TypeError** - 如果 `x` 和 `y` 的数据类型不是float16、float32或float64。
|
||||
- **ValueError** - 如果 `x` 不能广播到与 `y` 的shape一致。
|
||||
|
|
|
@ -4362,7 +4362,7 @@ class Tensor(Tensor_):
|
|||
|
||||
def xlogy(self, y):
|
||||
r"""
|
||||
Computes the first input tensor multiplied by the logarithm of second input tensor element-wise.
|
||||
Computes the self tensor multiplied by the logarithm of input tensor element-wise.
|
||||
Returns zero when self tensor is zero. The data type of the self tensor should be
|
||||
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore.html#mindspore.dtype>`_ or
|
||||
`bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore.html#mindspore.dtype>`_.
|
||||
|
|
|
@ -2685,20 +2685,7 @@ class Erfc(Primitive):
|
|||
r"""
|
||||
Computes the complementary error function of `x` element-wise.
|
||||
|
||||
.. math::
|
||||
|
||||
erfc(x) = 1 - \frac{2} {\sqrt{\pi}} \int\limits_0^{x} e^{-t^{2}} dt
|
||||
|
||||
Inputs:
|
||||
- **x** (Tensor) - The input tensor. The data type must be float16 or float32.
|
||||
:math:`(N,*)` where :math:`*` means, any number of additional dimensions, its rank should be less than 8.
|
||||
|
||||
Outputs:
|
||||
Tensor, has the same shap dtype as the `x`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `x` is not a Tensor.
|
||||
TypeError: If dtype of `x` is not float16 or float32.
|
||||
Refer to :func:`mindspore.ops.erfc` for more detail.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
@ -3378,34 +3365,7 @@ class Xlogy(Primitive):
|
|||
Computes the first input tensor multiplied by the logarithm of second input tensor element-wise.
|
||||
Returns zero when `x` is zero.
|
||||
|
||||
.. math::
|
||||
|
||||
out_i = x_{i}\ln{y_{i}}
|
||||
|
||||
Inputs of `x` and `y` comply with the implicit type conversion rules to make the data types consistent.
|
||||
The inputs must be two tensors or one tensor and one scalar.
|
||||
When the inputs are two tensors,
|
||||
dtypes of them cannot be bool at the same time, and the shapes of them could be broadcast.
|
||||
When the inputs are one tensor and one scalar,
|
||||
the scalar could only be a constant.
|
||||
|
||||
Inputs:
|
||||
- **x** (Union[Tensor, number.Number, bool]) - The first input is a number.Number or
|
||||
a bool or a tensor whose data type is
|
||||
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore.html#mindspore.dtype>`_ or
|
||||
`bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore.html#mindspore.dtype>`_.
|
||||
- **y** (Union[Tensor, number.Number, bool]) - The second input is a number.Number or
|
||||
a bool when the first input is a tensor or a tensor whose data type is number or bool\_.
|
||||
When the first input is Scalar, the second input must be a Tensor whose data type is number or bool\_.
|
||||
|
||||
Outputs:
|
||||
Tensor, the shape is the same as the one after broadcasting,
|
||||
and the data type is the one with higher precision or higher digits among the two inputs.
|
||||
|
||||
Raises:
|
||||
TypeError: If `x` and `y` is not a number.Number or a bool or a Tensor.
|
||||
TypeError: If dtype of `x` and `y` is not in [float16, float32, float64].
|
||||
ValueError: If `x` could not be broadcast to a tensor with shape of `y`.
|
||||
Refer to :func:`mindspore.ops.xlogy` for more detail.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``CPU``
|
||||
|
|
Loading…
Reference in New Issue