-
Notifications
You must be signed in to change notification settings - Fork 724
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.. _cn_api_fluid_layers_atan2: | ||
|
||
atan2 | ||
------------------------------- | ||
|
||
.. py:function:: paddle.atan2(y, x, name=None) | ||
对y/x进行逐元素的arctangent运算,通过符号确定象限 | ||
|
||
.. math:: | ||
atan2(y,x)=\left\{\begin{matrix} | ||
& tan^{-1}(\frac{y}{x}) & x > 0 \\ | ||
& tan^{-1}(\frac{y}{x}) + \pi & y>=0, x < 0 \\ | ||
& tan^{-1}(\frac{y}{x}) - \pi & y<0, x < 0 \\ | ||
& +\frac{\pi}{2} & y>0, x = 0 \\ | ||
& -\frac{\pi}{2} & y<0, x = 0 \\ | ||
&\text{undefined} & y=0, x = 0 | ||
\end{matrix}\right. | ||
参数: | ||
- y (Tensor) - 输入的Tensor,数据类型为:float32、float64、float16。 | ||
- x (Tensor) - 输入的Tensor,数据类型为:float32、float64、float16。 | ||
- name (str,可选) - 操作的名称(可选,默认值为None)。更多信息请参见 :ref:`api_guide_Name`。 | ||
|
||
返回: 输出Tensor,与 ``x`` 维度相同、数据类型相同。 | ||
|
||
返回类型: Tensor | ||
|
||
**代码示例**: | ||
|
||
.. code-block:: python | ||
import paddle | ||
y=paddle.to_tensor([-1, +1, +1, -1]).astype('float32') | ||
#Tensor(shape=[4], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [-1, 1, 1, -1]) | ||
x=paddle.to_tensor([-1, -1, +1, +1]).astype('float32') | ||
#Tensor(shape=[4], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [-1, -1, 1, 1]) | ||
out=paddle.atan2(y, x) | ||
#Tensor(shape=[4], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [-2.35619450, 2.35619450, 0.78539819, -0.78539819]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.. _cn_api_fluid_layers_expm1: | ||
|
||
expm1 | ||
------------------------------- | ||
|
||
.. py:function:: paddle.expm1(x, name=None) | ||
对输入,逐元素进行以自然数e为底指数运算并减1。 | ||
|
||
.. math:: | ||
out = e^x - 1 | ||
参数: | ||
- **x** (Tensor) - 该OP的输入为多维Tensor。数据类型为float32,float64,float16。 | ||
- **name** (str, 可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为None。 | ||
|
||
返回: 输出为Tensor,与 ``x`` 维度相同、数据类型相同。 | ||
|
||
返回类型: Tensor | ||
|
||
**代码示例**: | ||
|
||
.. code-block:: python | ||
import paddle | ||
x = paddle.to_tensor([-0.4, -0.2, 0.1, 0.3]) | ||
out = paddle.expm1(x) | ||
print(out) | ||
# [-0.32967997, -0.18126924, 0.10517092, 0.34985882] |