forked from PaddlePaddle/docs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add real & imag op and api cn doc (PaddlePaddle#3042)
* add real imag cn doc * fix detail error * add alias mapping * fix alias error
- Loading branch information
Showing
3 changed files
with
74 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
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,36 @@ | ||
.. _cn_api_tensor_imag: | ||
|
||
imag | ||
------ | ||
|
||
.. py:function:: paddle.imag(x, name=None) | ||
返回一个包含输入复数Tensor的虚部数值的新Tensor。 | ||
|
||
参数: | ||
- **x** (Tensor) - 输入Tensor,其数据类型可以为complex64或complex128。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 | ||
|
||
返回:Tensor,包含原复数Tensor的虚部数值。 | ||
|
||
**代码示例**: | ||
|
||
.. code-block:: python | ||
import paddle | ||
x = paddle.to_tensor( | ||
[[1 + 6j, 2 + 5j, 3 + 4j], [4 + 3j, 5 + 2j, 6 + 1j]]) | ||
# Tensor(shape=[2, 3], dtype=complex64, place=CUDAPlace(0), stop_gradient=True, | ||
# [[(1+6j), (2+5j), (3+4j)], | ||
# [(4+3j), (5+2j), (6+1j)]]) | ||
imag_res = paddle.imag(x) | ||
# Tensor(shape=[2, 3], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [[6., 5., 4.], | ||
# [3., 2., 1.]]) | ||
imag_t = x.imag() | ||
# Tensor(shape=[2, 3], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [[6., 5., 4.], | ||
# [3., 2., 1.]]) |
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,36 @@ | ||
.. _cn_api_tensor_real: | ||
|
||
real | ||
------ | ||
|
||
.. py:function:: paddle.real(x, name=None) | ||
返回一个包含输入复数Tensor的实部数值的新Tensor。 | ||
|
||
参数: | ||
- **x** (Tensor) - 输入Tensor,其数据类型可以为complex64或complex128。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 | ||
|
||
返回:Tensor,包含原复数Tensor的实部数值。 | ||
|
||
**代码示例**: | ||
|
||
.. code-block:: python | ||
import paddle | ||
x = paddle.to_tensor( | ||
[[1 + 6j, 2 + 5j, 3 + 4j], [4 + 3j, 5 + 2j, 6 + 1j]]) | ||
# Tensor(shape=[2, 3], dtype=complex64, place=CUDAPlace(0), stop_gradient=True, | ||
# [[(1+6j), (2+5j), (3+4j)], | ||
# [(4+3j), (5+2j), (6+1j)]]) | ||
real_res = paddle.real(x) | ||
# Tensor(shape=[2, 3], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [[1., 2., 3.], | ||
# [4., 5., 6.]]) | ||
real_t = x.real() | ||
# Tensor(shape=[2, 3], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [[1., 2., 3.], | ||
# [4., 5., 6.]]) |