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