[Docs] update formulas for math and array operators

pull/11770/head
hedongdong 4 years ago
parent 54b8d53780
commit 8107cb8283

@ -32,12 +32,21 @@ def _check_shape(input_shape, out_shape):
def clip_by_value(x, clip_value_min, clip_value_max):
"""
r"""
Clips tensor values to a specified min and max.
Limits the value of :math:`x` to a range, whose lower limit is 'clip_value_min'
and upper limit is 'clip_value_max'.
.. math::
out_i= \left\{
\begin{array}{align}
clip\_value_{max} & \text{ if } x_i\ge clip\_value_{max} \\
x_i & \text{ if } clip\_value_{min} \lt x_i \lt clip\_value_{max} \\
clip\_value_{min} & \text{ if } x_i \le clip\_value_{min} \\
\end{array}\right.
Note:
'clip_value_min' needs to be less than or equal to 'clip_value_max'.

File diff suppressed because it is too large Load Diff

@ -115,7 +115,7 @@ class _BitwiseBinaryOp(_MathBinaryOp):
class TensorAdd(_MathBinaryOp):
"""
r"""
Adds two input tensors element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
@ -125,6 +125,10 @@ class TensorAdd(_MathBinaryOp):
When the inputs are one tensor and one scalar,
the scalar could only be a constant.
.. math::
out_{i} = x_{i} + y_{i}
Inputs:
- **input_x** (Union[Tensor, Number, bool]) - The first input is a number, or a bool,
or a tensor whose data type is number or bool.
@ -690,7 +694,7 @@ class CumProd(PrimitiveWithInfer):
class MatMul(PrimitiveWithCheck):
"""
r"""
Multiplies matrix `a` and matrix `b`.
The rank of input tensors must equal to `2`.
@ -1257,6 +1261,10 @@ class Mul(_MathBinaryOp):
When the inputs are one tensor and one scalar,
the scalar could only be a constant.
.. math::
out_{i} = x_{i} * y_{i}
Inputs:
- **input_x** (Union[Tensor, Number, bool]) - The first input is a number or
a bool or a tensor whose data type is number or bool.
@ -1544,9 +1552,13 @@ class Pow(_MathBinaryOp):
class Exp(PrimitiveWithInfer):
"""
r"""
Returns exponential of a tensor element-wise.
.. math::
out_i = e^{x_i}
Inputs:
- **input_x** (Tensor) - The input tensor. The data type mast be float16 or float32.
@ -1586,9 +1598,13 @@ class Exp(PrimitiveWithInfer):
class Expm1(PrimitiveWithInfer):
"""
r"""
Returns exponential then minus 1 of a tensor element-wise.
.. math::
out_i = e^{x_i} - 1
Inputs:
- **input_x** (Tensor) - The input tensor. With float16 or float32 data type.
@ -1748,7 +1764,7 @@ class Erf(PrimitiveWithInfer):
.. math::
\text{erf}(x) = \frac{2}{\sqrt{\pi}}$\int$_{0}^{x}\exp(-t**2)dt
erf(x)=\frac{2} {\sqrt{\pi}} \int\limits_0^{x} e^{-t^{2}} dt
Inputs:
- **input_x** (Tensor) - The input tensor. The data type must be float16 or float32.
@ -1784,6 +1800,10 @@ class Erfc(PrimitiveWithInfer):
r"""
Computes the complementary error function of `input_x` element-wise.
.. math::
erfc(x) = 1 - \frac{2} {\sqrt{\pi}} \int\limits_0^{x} e^{-t^{2}} dt
Inputs:
- **input_x** (Tensor) - The input tensor. The data type must be float16 or float32.
@ -1944,7 +1964,7 @@ class RealDiv(_MathBinaryOp):
class Div(_MathBinaryOp):
"""
r"""
Computes the quotient of dividing the first input tensor by the second input tensor element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
@ -1954,6 +1974,10 @@ class Div(_MathBinaryOp):
When the inputs are one tensor and one scalar,
the scalar could only be a constant.
.. math::
out_{i} = \frac{x_i}{y_i}
Inputs:
- **input_x** (Union[Tensor, Number, bool]) - The first input is a number or
a bool or a tensor whose data type is number or bool.
@ -2233,9 +2257,13 @@ class Mod(_MathBinaryOp):
class Floor(PrimitiveWithInfer):
"""
r"""
Rounds a tensor down to the closest integer element-wise.
.. math::
out_i = \lfloor x_i \rfloor
Inputs:
- **input_x** (Tensor) - The input tensor. Its element data type must be float.
@ -2300,12 +2328,12 @@ class FloorMod(_MathBinaryOp):
class Ceil(PrimitiveWithInfer):
"""
r"""
Rounds a tensor up to the closest integer element-wise.
.. math::
out_i = [input_i] = [input_i] + 1
out_i = \lceil x_i \rceil = \lfloor x_i \rfloor + 1
Inputs:
- **input_x** (Tensor) - The input tensor. It's element data type must be float16 or float32.
@ -2484,7 +2512,7 @@ class Cosh(PrimitiveWithInfer):
class Asinh(PrimitiveWithInfer):
"""
r"""
Computes inverse hyperbolic sine of the input element-wise.
.. math::
@ -3312,12 +3340,12 @@ class Cos(PrimitiveWithInfer):
class ACos(PrimitiveWithInfer):
"""
r"""
Computes arccosine of input tensors element-wise.
.. math::
out_i = cos^{-1}(input_i)
out_i = cos^{-1}(x_i)
Inputs:
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
@ -3382,9 +3410,13 @@ class Sin(PrimitiveWithInfer):
class Asin(PrimitiveWithInfer):
"""
r"""
Computes arcsine of input tensors element-wise.
.. math::
out_i = sin^{-1}(x_i)
Inputs:
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
@ -3480,12 +3512,12 @@ class NMSWithMask(PrimitiveWithInfer):
class Abs(PrimitiveWithInfer):
"""
r"""
Returns absolute value of a tensor element-wise.
.. math::
out_i = |input_i|
out_i = |x_i|
Inputs:
- **input_x** (Tensor) - The input tensor. The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
@ -3633,12 +3665,12 @@ class Tan(PrimitiveWithInfer):
class Atan(PrimitiveWithInfer):
"""
r"""
Computes the trigonometric inverse tangent of the input element-wise.
.. math::
out_i = tan^{-1}(input_i)
out_i = tan^{-1}(x_i)
Inputs:
- **input_x** (Tensor): The input tensor. The data type should be one of the following types: float16, float32.

Loading…
Cancel
Save