-
Notifications
You must be signed in to change notification settings - Fork 724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new api paddle.trunc #3585
new api paddle.trunc #3585
Changes from 8 commits
f0f2dfd
0985a48
da6c34e
42b1ab7
ef5b662
c7c1754
6d4a664
b79de68
4f1f7ad
720b25b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.. _api_paddle_trunc: | ||
|
||
trunc | ||
------------------------------- | ||
:doc_source: paddle.trunc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.. _cn_api_tensor_trunc: | ||
|
||
trunc | ||
------------------------------- | ||
|
||
.. py:function:: paddle.trunc(input, name=None) | ||
|
||
|
||
将输入矩阵数据的小数部分置0,返回置0后的矩阵,如果输入矩阵的数据类型为整数,则不做处理。 | ||
|
||
|
||
参数: | ||
- **input** (Tensor) : 输入变量,类型为 Tensor, 支持int、float、double数据类型。 | ||
- **name** (str,可选)- 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 | ||
|
||
返回: | ||
- Tensor (Tensor),矩阵截断后的结果。 | ||
|
||
|
||
**代码示例**: | ||
|
||
.. code-block:: python | ||
|
||
import paddle | ||
|
||
input = paddle.rand([2,2],'float32') | ||
print(input) | ||
# Tensor(shape=[2, 2], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [[0.02331470, 0.42374918], | ||
# [0.79647720, 0.74970269]]) | ||
|
||
output = paddle.trunc(input) | ||
print(output) | ||
# Tensor(shape=[2, 2], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [[0., 0.], | ||
# [0., 0.]]) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.. _cn_api_tensor_trunc: | ||
|
||
trunc | ||
------------------------------- | ||
|
||
.. py:function:: paddle.trunc(input, name=None) | ||
|
||
|
||
将输入矩阵数据的小数部分置0,返回置0后的矩阵,如果输入矩阵的数据类型为整数,则不做处理。 | ||
|
||
|
||
参数: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 参数: -> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done,thanks! |
||
- **input** (Tensor) : 输入变量,类型为 Tensor, 支持int、float、double数据类型。 | ||
- **name** (str,可选)- 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 | ||
|
||
返回: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 返回: -> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done,thanks! |
||
- Tensor (Tensor),矩阵截断后的结果。 | ||
|
||
|
||
**代码示例**: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 代码示例: -> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done,thanks! |
||
|
||
.. code-block:: python | ||
|
||
import paddle | ||
|
||
input = paddle.rand([2,2],'float32') | ||
print(input) | ||
# Tensor(shape=[2, 2], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [[0.02331470, 0.42374918], | ||
# [0.79647720, 0.74970269]]) | ||
|
||
output = paddle.trunc(input) | ||
print(output) | ||
# Tensor(shape=[2, 2], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [[0., 0.], | ||
# [0., 0.]])) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.. _cn_api_tensor_trunc: | ||
|
||
trunc | ||
------------------------------- | ||
|
||
.. py:function:: paddle.trunc(input, name=None) | ||
|
||
|
||
将输入矩阵数据的小数部分置0,返回置0后的矩阵,如果输入矩阵的数据类型为整数,则不做处理。 | ||
|
||
|
||
参数: | ||
- **input** (Tensor) : 输入变量,类型为 Tensor, 支持int、float、double数据类型。 | ||
- **name** (str,可选)- 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 | ||
|
||
返回: | ||
- Tensor (Tensor),矩阵截断后的结果。 | ||
|
||
|
||
**代码示例**: | ||
|
||
.. code-block:: python | ||
|
||
import paddle | ||
|
||
input = paddle.rand([2,2],'float32') | ||
print(input) | ||
# Tensor(shape=[2, 2], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [[0.02331470, 0.42374918], | ||
# [0.79647720, 0.74970269]]) | ||
|
||
output = paddle.trunc(input) | ||
print(output) | ||
# Tensor(shape=[2, 2], dtype=float32, place=CUDAPlace(0), stop_gradient=True, | ||
# [[0., 0.], | ||
# [0., 0.]])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
输入矩阵数据 -> 输入
Tensor
矩阵 ->
Tensor
输入矩阵 -> 输入
Tensor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done,thanks!