Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
urhero
Paddle
提交
94fdb8eb
P
Paddle
项目概览
urhero
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
94fdb8eb
编写于
4月 20, 2020
作者:
L
liuwei1031
提交者:
GitHub
4月 20, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tweak doc of dot and logsumexp, test=develop (#23925)
上级
30bd7e1c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
41 addition
and
25 deletion
+41
-25
python/paddle/tensor/linalg.py
python/paddle/tensor/linalg.py
+3
-1
python/paddle/tensor/math.py
python/paddle/tensor/math.py
+38
-24
未找到文件。
python/paddle/tensor/linalg.py
浏览文件 @
94fdb8eb
...
@@ -421,11 +421,13 @@ def dot(x, y, name=None):
...
@@ -421,11 +421,13 @@ def dot(x, y, name=None):
Only support 1-d Tensor(vector).
Only support 1-d Tensor(vector).
Parameters:
Parameters:
x(Variable): 1-D ``Tensor`` or ``LoDTensor``. Its datatype should be ``float32``, ``float64``, ``int32``, ``int64``
x(Variable): 1-D ``Tensor`` or ``LoDTensor``. Its datatype should be ``float32``, ``float64``, ``int32``, ``int64``
y(Variable): 1-D ``Tensor`` or ``LoDTensor``. Its datatype soulde be ``float32``, ``float64``, ``int32``, ``int64``
y(Variable): 1-D ``Tensor`` or ``LoDTensor``. Its datatype soulde be ``float32``, ``float64``, ``int32``, ``int64``
name(str, optional): Name of the output. Default is None. It's used to print debug info for developers. Details: :ref:`api_guide_Name`
name(str, optional): Name of the output. Default is None. It's used to print debug info for developers. Details: :ref:`api_guide_Name`
Returns:
Variable: the calculated result Tensor/LoDTensor.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
...
python/paddle/tensor/math.py
浏览文件 @
94fdb8eb
...
@@ -1012,38 +1012,52 @@ def addmm(input, x, y, alpha=1.0, beta=1.0, name=None):
...
@@ -1012,38 +1012,52 @@ def addmm(input, x, y, alpha=1.0, beta=1.0, name=None):
def
logsumexp
(
x
,
dim
=
None
,
keepdim
=
False
,
out
=
None
,
name
=
None
):
def
logsumexp
(
x
,
dim
=
None
,
keepdim
=
False
,
out
=
None
,
name
=
None
):
"""
"""
This operator calculates the log of the sum of exponentials of the input Tensor.
This operator calculates the log of the sum of exponentials of the input Tensor.
.. math::
.. math::
logsumexp(x) = \log\sum exp(x)
logsumexp(x) = \log\sum exp(x)
Parameters:
x (Variable): Input LoDTensor or Tensor. Must be one of the following types: float32, float64.
dim (list|int, optional): The dimensions along which the sum is performed. If :attr:`None`,
sum all elements of :attr:`input` and return a Tensor variable with a single element,
otherwise must be in the range :math:`[-rank(input), rank(input))`. If :math:`dim[i] < 0`,
the dimension to reduce is :math:`rank + dim[i]`.
keep_dim (bool, optional): Whether to reserve the reduced dimension in the output Tensor.
The result tensor will have one fewer dimension than the :attr:`input` unless :attr:`keep_dim`
is true, default value is False.
out (Variable), optional): Enable user to explicitly specify an output variable to save result.
name (str, optional): The default value is None. Normally there is no need for user to
set this property. For more information, please refer to :ref:`api_guide_Name`
Returns:
Variable: The calcuated result Tensor/LoDTensor.
Parameters:
Examples:
x (Variable): Input LoDTensor or Tensor. Must be one of the following types: float32, float64.
dim (list|int, optional): The dimensions along which the sum is performed. If :attr:`None`,
sum all elements of :attr:`input` and return a Tensor variable with a single element,
otherwise must be in the range :math:`[-rank(input), rank(input))`. If :math:`dim[i] < 0`,
the dimension to reduce is :math:`rank + dim[i]`.
keep_dim (bool, optional): Whether to reserve the reduced dimension in the output Tensor.
The result tensor will have one fewer dimension than the :attr:`input` unless :attr:`keep_dim`
is true, default value is False.
name (str, optional): The default value is None. Normally there is no need for user to
set this property. For more information, please refer to :ref:`api_guide_Name`
.. code-block:: python
Examples:
import paddle
import paddle.fluid as fluid
import numpy as np
.. code-block:: python
with fluid.dygraph.guard():
np_x = np.random.uniform(0.1, 1, [10]).astype(np.float32)
x = fluid.dygraph.to_variable(np_x)
print(paddle.logsumexp(x).numpy())
import paddle
.. code-block:: python
import paddle.fluid as fluid
import numpy as np
import paddle
import paddle.fluid as fluid
with fluid.dygraph.guard():
import numpy as np
np_x = np.random.uniform(0.1, 1, [10]).astype(np.float32)
x = fluid.dygraph.to_variable(np_x)
print(paddle.logsumexp(x).numpy())
with fluid.dygraph.guard():
np_x = np.random.uniform(0.1, 1, [2, 3, 4]).astype(np.float32)
x = fluid.dygraph.to_variable(np_x)
print(paddle.logsumexp(x, dim=1).numpy())
print(paddle.logsumexp(x, dim=[0, 2]).numpy())
"""
"""
op_type
=
'logsumexp'
op_type
=
'logsumexp'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录