Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
c3fdf3ae
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
提交
c3fdf3ae
编写于
8月 09, 2018
作者:
M
minqiyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix divide problem in CI
Fix pb_protobuf2 FromString problem
上级
db7d8136
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
27 addition
and
22 deletion
+27
-22
paddle/fluid/framework/op_desc.cc
paddle/fluid/framework/op_desc.cc
+1
-0
python/paddle/fluid/backward.py
python/paddle/fluid/backward.py
+1
-1
python/paddle/fluid/debugger.py
python/paddle/fluid/debugger.py
+1
-1
python/paddle/fluid/framework.py
python/paddle/fluid/framework.py
+4
-1
python/paddle/fluid/tests/unittests/test_conv2d_op.py
python/paddle/fluid/tests/unittests/test_conv2d_op.py
+11
-11
python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py
.../paddle/fluid/tests/unittests/test_conv2d_transpose_op.py
+2
-2
python/paddle/fluid/tests/unittests/test_lrn_op.py
python/paddle/fluid/tests/unittests/test_lrn_op.py
+1
-1
python/paddle/fluid/tests/unittests/test_operator_desc.py
python/paddle/fluid/tests/unittests/test_operator_desc.py
+3
-2
python/paddle/fluid/tests/unittests/test_parallel_executor_seresnext.py
...fluid/tests/unittests/test_parallel_executor_seresnext.py
+2
-2
python/paddle/fluid/transpiler/memory_optimization_transpiler.py
...paddle/fluid/transpiler/memory_optimization_transpiler.py
+1
-1
未找到文件。
paddle/fluid/framework/op_desc.cc
浏览文件 @
c3fdf3ae
...
...
@@ -202,6 +202,7 @@ std::vector<std::string> OpDesc::AttrNames() const {
}
void
OpDesc
::
SetAttr
(
const
std
::
string
&
name
,
const
Attribute
&
v
)
{
VLOG
(
11
)
<<
"SetAttr: "
<<
Type
()
<<
", "
<<
name
<<
", "
<<
v
.
which
();
// NOTICE(minqiyang): pybind11 will take the empty list in python as
// the std::vector<int> type in C++; so we have to change the attr's type
// here if we meet this issue
...
...
python/paddle/fluid/backward.py
浏览文件 @
c3fdf3ae
...
...
@@ -243,7 +243,7 @@ from .proto import framework_pb2
def
serialize_op_decs
(
op_desc
):
protostr
=
op_desc
.
serialize_to_string
()
proto
=
framework_pb2
.
OpDesc
.
FromString
(
s
tr
(
protostr
))
proto
=
framework_pb2
.
OpDesc
.
FromString
(
s
ix
.
binary_type
(
protostr
))
return
proto
.
__str__
()
...
...
python/paddle/fluid/debugger.py
浏览文件 @
c3fdf3ae
...
...
@@ -225,7 +225,7 @@ def draw_block_graphviz(block, highlights=None, path="./temp.dot"):
graph
=
GraphPreviewGenerator
(
"some graph"
)
# collect parameters and args
protostr
=
block
.
desc
.
serialize_to_string
()
desc
=
framework_pb2
.
BlockDesc
.
FromString
(
s
tr
(
protostr
))
desc
=
framework_pb2
.
BlockDesc
.
FromString
(
s
ix
.
binary_type
(
protostr
))
def
need_highlight
(
name
):
if
highlights
is
None
:
return
False
...
...
python/paddle/fluid/framework.py
浏览文件 @
c3fdf3ae
...
...
@@ -28,7 +28,7 @@ except ImportError as e:
"""NOTE: You may need to run
\"
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
\"
if you encounters
\"
libmkldnn.so not found
\"
errors. If you have python
installed in other directory, replace
\"
/usr/local/lib
\"
with your own
directory. The original error is:
\n
"""
+
e
.
message
)
directory. The original error is:
\n
"""
+
cpt
.
get_exception_message
(
e
)
)
except
Exception
as
e
:
raise
e
from
.
import
unique_name
...
...
@@ -574,6 +574,9 @@ class Operator(object):
attr_val
=
self
.
attrs
[
attr_name
]
self
.
_update_desc_attr
(
attr_name
,
attr_val
)
import
sys
print
(
'self.attrs'
,
self
.
attrs
)
sys
.
stdout
.
flush
()
self
.
desc
.
check_attrs
()
if
self
.
has_kernel
(
type
):
self
.
desc
.
infer_var_type
(
self
.
block
.
desc
)
...
...
python/paddle/fluid/tests/unittests/test_conv2d_op.py
浏览文件 @
c3fdf3ae
...
...
@@ -24,12 +24,12 @@ def conv2d_forward_naive(input, filter, group, conv_param):
out_c
,
f_c
,
f_h
,
f_w
=
filter
.
shape
assert
f_c
*
group
==
in_c
assert
np
.
mod
(
out_c
,
group
)
==
0
sub_out_c
=
out_c
/
group
sub_out_c
=
out_c
/
/
group
stride
,
pad
,
dilation
=
conv_param
[
'stride'
],
conv_param
[
'pad'
],
conv_param
[
'dilation'
]
out_h
=
1
+
(
in_h
+
2
*
pad
[
0
]
-
(
dilation
[
0
]
*
(
f_h
-
1
)
+
1
))
/
stride
[
0
]
out_w
=
1
+
(
in_w
+
2
*
pad
[
1
]
-
(
dilation
[
1
]
*
(
f_w
-
1
)
+
1
))
/
stride
[
1
]
out_h
=
1
+
(
in_h
+
2
*
pad
[
0
]
-
(
dilation
[
0
]
*
(
f_h
-
1
)
+
1
))
/
/
stride
[
0
]
out_w
=
1
+
(
in_w
+
2
*
pad
[
1
]
-
(
dilation
[
1
]
*
(
f_w
-
1
)
+
1
))
/
/
stride
[
1
]
out
=
np
.
zeros
((
in_n
,
out_c
,
out_h
,
out_w
))
d_bolck_h
=
(
dilation
[
0
]
*
(
f_h
-
1
)
+
1
)
...
...
@@ -160,7 +160,7 @@ class TestConv2dOp(OpTest):
self
.
stride
=
[
1
,
1
]
self
.
input_size
=
[
2
,
3
,
5
,
5
]
# NCHW
assert
np
.
mod
(
self
.
input_size
[
1
],
self
.
groups
)
==
0
f_c
=
self
.
input_size
[
1
]
/
self
.
groups
f_c
=
self
.
input_size
[
1
]
/
/
self
.
groups
self
.
filter_size
=
[
6
,
f_c
,
3
,
3
]
def
init_dilation
(
self
):
...
...
@@ -179,7 +179,7 @@ class TestWithPad(TestConv2dOp):
self
.
stride
=
[
1
,
1
]
self
.
input_size
=
[
2
,
3
,
5
,
5
]
# NCHW
assert
np
.
mod
(
self
.
input_size
[
1
],
self
.
groups
)
==
0
f_c
=
self
.
input_size
[
1
]
/
self
.
groups
f_c
=
self
.
input_size
[
1
]
/
/
self
.
groups
self
.
filter_size
=
[
6
,
f_c
,
3
,
3
]
...
...
@@ -189,7 +189,7 @@ class TestWithStride(TestConv2dOp):
self
.
stride
=
[
2
,
2
]
self
.
input_size
=
[
2
,
3
,
6
,
6
]
# NCHW
assert
np
.
mod
(
self
.
input_size
[
1
],
self
.
groups
)
==
0
f_c
=
self
.
input_size
[
1
]
/
self
.
groups
f_c
=
self
.
input_size
[
1
]
/
/
self
.
groups
self
.
filter_size
=
[
6
,
f_c
,
3
,
3
]
...
...
@@ -204,7 +204,7 @@ class TestWith1x1(TestConv2dOp):
self
.
stride
=
[
1
,
1
]
self
.
input_size
=
[
2
,
3
,
5
,
5
]
# NCHW
assert
np
.
mod
(
self
.
input_size
[
1
],
self
.
groups
)
==
0
f_c
=
self
.
input_size
[
1
]
/
self
.
groups
f_c
=
self
.
input_size
[
1
]
/
/
self
.
groups
self
.
filter_size
=
[
6
,
f_c
,
1
,
1
]
def
init_group
(
self
):
...
...
@@ -217,7 +217,7 @@ class TestWithDilation(TestConv2dOp):
self
.
stride
=
[
1
,
1
]
self
.
input_size
=
[
2
,
3
,
10
,
10
]
# NCHW
assert
np
.
mod
(
self
.
input_size
[
1
],
self
.
groups
)
==
0
f_c
=
self
.
input_size
[
1
]
/
self
.
groups
f_c
=
self
.
input_size
[
1
]
/
/
self
.
groups
self
.
filter_size
=
[
6
,
f_c
,
3
,
3
]
def
init_dilation
(
self
):
...
...
@@ -233,7 +233,7 @@ class TestWithInput1x1Filter1x1(TestConv2dOp):
self
.
stride
=
[
1
,
1
]
self
.
input_size
=
[
2
,
3
,
1
,
1
]
# NCHW
assert
np
.
mod
(
self
.
input_size
[
1
],
self
.
groups
)
==
0
f_c
=
self
.
input_size
[
1
]
/
self
.
groups
f_c
=
self
.
input_size
[
1
]
/
/
self
.
groups
self
.
filter_size
=
[
6
,
f_c
,
1
,
1
]
def
init_group
(
self
):
...
...
@@ -350,7 +350,7 @@ class TestDepthwiseConv(TestConv2dOp):
self
.
input_size
=
[
2
,
3
,
5
,
5
]
# NCHW
self
.
groups
=
3
assert
np
.
mod
(
self
.
input_size
[
1
],
self
.
groups
)
==
0
f_c
=
self
.
input_size
[
1
]
/
self
.
groups
f_c
=
self
.
input_size
[
1
]
/
/
self
.
groups
self
.
filter_size
=
[
6
,
f_c
,
3
,
3
]
self
.
op_type
=
"depthwise_conv2d"
...
...
@@ -362,7 +362,7 @@ class TestDepthwiseConv2(TestConv2dOp):
self
.
input_size
=
[
2
,
3
,
5
,
5
]
# NCHW
self
.
groups
=
3
assert
np
.
mod
(
self
.
input_size
[
1
],
self
.
groups
)
==
0
f_c
=
self
.
input_size
[
1
]
/
self
.
groups
f_c
=
self
.
input_size
[
1
]
/
/
self
.
groups
self
.
filter_size
=
[
6
,
f_c
,
3
,
3
]
self
.
op_type
=
"depthwise_conv2d"
...
...
python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py
浏览文件 @
c3fdf3ae
...
...
@@ -25,7 +25,7 @@ def conv2dtranspose_forward_naive(input_, filter_, attrs):
groups
=
attrs
[
'groups'
]
assert
in_c
==
f_c
out_c
=
f_out_c
*
groups
sub_in_c
=
in_c
/
groups
sub_in_c
=
in_c
/
/
groups
stride
,
pad
,
dilations
=
attrs
[
'strides'
],
attrs
[
'paddings'
],
attrs
[
'dilations'
]
...
...
@@ -258,7 +258,7 @@ class TestDepthwiseConvTranspose(TestConv2dTransposeOp):
self
.
input_size
=
[
2
,
8
,
16
,
16
]
# NCHW
self
.
groups
=
8
assert
np
.
mod
(
self
.
input_size
[
1
],
self
.
groups
)
==
0
f_c
=
self
.
input_size
[
1
]
/
self
.
groups
f_c
=
self
.
input_size
[
1
]
/
/
self
.
groups
self
.
filter_size
=
[
self
.
input_size
[
1
],
f_c
,
4
,
4
]
self
.
op_type
=
"depthwise_conv2d_transpose"
...
...
python/paddle/fluid/tests/unittests/test_lrn_op.py
浏览文件 @
c3fdf3ae
...
...
@@ -34,7 +34,7 @@ class TestLRNOp(OpTest):
return
x
+
1
def
get_out
(
self
):
start
=
-
(
self
.
n
-
1
)
/
2
start
=
-
(
self
.
n
-
1
)
/
/
2
end
=
start
+
self
.
n
mid
=
np
.
empty
((
self
.
N
,
self
.
C
,
self
.
H
,
self
.
W
)).
astype
(
"float32"
)
...
...
python/paddle/fluid/tests/unittests/test_operator_desc.py
浏览文件 @
c3fdf3ae
...
...
@@ -15,6 +15,7 @@
import
unittest
import
paddle.fluid.core
as
core
import
paddle.fluid.compat
as
cpt
from
paddle.fluid.framework
import
Program
,
default_startup_program
...
...
@@ -29,13 +30,13 @@ class TestOperator(unittest.TestCase):
self
.
assertFail
()
except
ValueError
as
v_err
:
self
.
assertEqual
(
v_err
.
message
,
cpt
.
get_exception_message
(
v_err
)
,
"`type` to initilized an Operator can not be None."
)
try
:
block
.
append_op
(
type
=
"no_such_op"
)
self
.
assertFail
()
except
ValueError
as
a_err
:
self
.
assertEqual
(
a_err
.
message
,
self
.
assertEqual
(
cpt
.
get_exception_message
(
a_err
)
,
"Operator
\"
no_such_op
\"
has not been registered."
)
def
test_op_desc_creation
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_parallel_executor_seresnext.py
浏览文件 @
c3fdf3ae
...
...
@@ -33,7 +33,7 @@ def squeeze_excitation(input, num_channels, reduction_ratio):
pool
=
fluid
.
layers
.
reduce_mean
(
input
=
reshape
,
dim
=
2
)
squeeze
=
fluid
.
layers
.
fc
(
input
=
pool
,
size
=
num_channels
/
reduction_ratio
,
size
=
num_channels
/
/
reduction_ratio
,
act
=
'relu'
)
excitation
=
fluid
.
layers
.
fc
(
input
=
squeeze
,
size
=
num_channels
,
...
...
@@ -49,7 +49,7 @@ def conv_bn_layer(input, num_filters, filter_size, stride=1, groups=1,
num_filters
=
num_filters
,
filter_size
=
filter_size
,
stride
=
stride
,
padding
=
(
filter_size
-
1
)
/
2
,
padding
=
(
filter_size
-
1
)
/
/
2
,
groups
=
groups
,
act
=
None
,
bias_attr
=
False
)
...
...
python/paddle/fluid/transpiler/memory_optimization_transpiler.py
浏览文件 @
c3fdf3ae
...
...
@@ -14,7 +14,7 @@
from
collections
import
defaultdict
from
..
import
core
from
..
import
compat
from
..
import
compat
as
cpt
from
..framework
import
Program
,
default_main_program
,
Parameter
from
..backward
import
_rename_arg_
from
functools
import
reduce
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录