Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
6602ccf4
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
6602ccf4
编写于
7月 16, 2020
作者:
S
Shibo Tao
提交者:
GitHub
7月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
delete mul op. (#25499)
* delete mul op. test=develop,test=document_fix * bug fix. test=develop,test=document_fix
上级
79fe67fb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
0 addition
and
90 deletion
+0
-90
python/paddle/__init__.py
python/paddle/__init__.py
+0
-1
python/paddle/tensor/__init__.py
python/paddle/tensor/__init__.py
+0
-1
python/paddle/tensor/math.py
python/paddle/tensor/math.py
+0
-88
未找到文件。
python/paddle/__init__.py
浏览文件 @
6602ccf4
...
...
@@ -146,7 +146,6 @@ from .tensor.math import exp #DEFINE_ALIAS
from
.tensor.math
import
floor
#DEFINE_ALIAS
from
.tensor.math
import
increment
#DEFINE_ALIAS
from
.tensor.math
import
log
#DEFINE_ALIAS
from
.tensor.math
import
mul
#DEFINE_ALIAS
from
.tensor.math
import
multiplex
#DEFINE_ALIAS
from
.tensor.math
import
pow
#DEFINE_ALIAS
from
.tensor.math
import
reciprocal
#DEFINE_ALIAS
...
...
python/paddle/tensor/__init__.py
浏览文件 @
6602ccf4
...
...
@@ -119,7 +119,6 @@ from .math import exp #DEFINE_ALIAS
from
.math
import
floor
#DEFINE_ALIAS
from
.math
import
increment
#DEFINE_ALIAS
from
.math
import
log
#DEFINE_ALIAS
from
.math
import
mul
#DEFINE_ALIAS
from
.math
import
multiplex
#DEFINE_ALIAS
from
.math
import
pow
#DEFINE_ALIAS
from
.math
import
reciprocal
#DEFINE_ALIAS
...
...
python/paddle/tensor/math.py
浏览文件 @
6602ccf4
...
...
@@ -260,94 +260,6 @@ def pow(input, exponent, out=None, name=None):
return
out
def
mul
(
x
,
y
,
x_num_col_dims
=
1
,
y_num_col_dims
=
1
,
out
=
None
,
name
=
None
):
"""
:alias_main: paddle.mul
:alias: paddle.mul,paddle.tensor.mul,paddle.tensor.math.mul
Mul Operator.
This operator is used to perform matrix multiplication for input $x$ and $y$.
The equation is:
.. math::
Out = x * y
Both the input $x$ and $y$ can carry the LoD (Level of Details) information, or not.
But the output only shares the LoD information with input $x$.
Args:
x (Variable): The first input Tensor/LoDTensor of mul_op.
y (Variable): The second input Tensor/LoDTensor of mul_op.
x_num_col_dims (int, optional): The mul_op can take tensors with more than two dimensions as its inputs.
If the input $x$ is a tensor with more than two dimensions, $x$ will be flattened into a two-dimensional
matrix first. The flattening rule is: the first `num_col_dims` will be flattened to form the first
dimension of the final matrix (the height of the matrix), and the rest `rank(x) - num_col_dims`
dimensions are flattened to form the second dimension of the final matrix (the width of the matrix).
As a result, height of the flattened matrix is equal to the product of $x$'s first `x_num_col_dims` dimensions'
sizes, and width of the flattened matrix is equal to the product of $x$'s last `rank(x) - num_col_dims`
dimensions' size. For example, suppose $x$ is a 6-dimensional tensor with the shape [2, 3, 4, 5, 6],
and `x_num_col_dims` = 3. Thus, the flattened matrix will have a shape [2 x 3 x 4, 5 x 6] = [24, 30]. Default is 1.
y_num_col_dims (int, optional): The mul_op can take tensors with more than two dimensions as its inputs. If the
input $y$ is a tensor with more than two dimensions, $y$ will be flattened into a two-dimensional matrix first.
The attribute `y_num_col_dims` determines how $y$ is flattened. See comments of `x_num_col_dims` for more details.
Default is 1.
out(Variable, optinal): The Variable that stores results of the operation. If out is None,
a new Variable will be created to store the results.
name (str, optional): Name of the output. Normally there is no need for user to set this property.
For more information, please refer to :ref:`api_guide_Name`. Default is None. If both of out and name are not None,
the output name will be same as out.
Returns:
Variable(Tensor/LoDTensor): The output Tensor/LoDTensor of mul op.
Examples:
.. code-block:: python
import paddle
import paddle.fluid as fluid
dataX = fluid.data(name="dataX", shape=[2, 5], dtype="float32")
dataY = fluid.data(name="dataY", shape=[5, 3], dtype="float32")
res = fluid.data(name="output", shape=[2, 3], dtype="float32")
output = paddle.mul(dataX, dataY,
x_num_col_dims = 1,
y_num_col_dims = 1,
out=res)
"""
inputs
=
{
"X"
:
[
x
],
"Y"
:
[
y
]}
attrs
=
{
"x_num_col_dims"
:
x_num_col_dims
,
"y_num_col_dims"
:
y_num_col_dims
}
if
in_dygraph_mode
():
outs
=
core
.
ops
.
mul
(
inputs
,
attrs
)
return
outs
[
'Out'
][
0
]
helper
=
LayerHelper
(
"mul"
,
**
locals
())
check_variable_and_dtype
(
x
,
'x'
,
[
'float16'
,
'float32'
,
'float64'
],
'mul'
)
check_variable_and_dtype
(
y
,
'y'
,
[
'float16'
,
'float32'
,
'float64'
],
'mul'
)
if
out
is
None
:
out
=
helper
.
create_variable_for_type_inference
(
dtype
=
x
.
dtype
)
else
:
check_dtype
(
out
.
dtype
,
out
.
name
,
convert_dtype
(
x
.
dtype
),
'mul'
,
'(The out data type in pow must be the same with input data type.)'
)
if
name
:
warnings
.
warn
(
"The output Variable name of the paddle.tensor.pow operation can only be given by parameter out or name.
\
When parameter out and name are set at the same time, out has a higher priority than name.
\
Finally, the output Variable name is same as the out name %s"
%
out
.
name
,
category
=
UserWarning
,
stacklevel
=
2
)
helper
.
append_op
(
type
=
"mul"
,
inputs
=
{
"X"
:
x
,
"Y"
:
y
},
attrs
=
attrs
,
outputs
=
{
"Out"
:
out
})
return
out
__ops__noattr__
=
[
'atan'
,
'sin'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录