Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
deb0d41c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
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看板
提交
deb0d41c
编写于
12月 12, 2018
作者:
S
sneaxiy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix cmake
fix cmake again test=develop
上级
e7c5c9d2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
23 addition
and
26 deletion
+23
-26
paddle/fluid/operators/CMakeLists.txt
paddle/fluid/operators/CMakeLists.txt
+6
-3
paddle/fluid/operators/py_func_op.cc
paddle/fluid/operators/py_func_op.cc
+2
-2
paddle/fluid/operators/py_func_op.h
paddle/fluid/operators/py_func_op.h
+1
-1
paddle/fluid/pybind/CMakeLists.txt
paddle/fluid/pybind/CMakeLists.txt
+3
-0
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+11
-20
未找到文件。
paddle/fluid/operators/CMakeLists.txt
浏览文件 @
deb0d41c
...
...
@@ -42,8 +42,7 @@ if (WITH_DISTRIBUTE)
SET
(
OP_PREFETCH_DEPS
${
OP_PREFETCH_DEPS
}
parameter_prefetch
)
endif
()
register_operators
(
EXCLUDES warpctc_op conv_fusion_op DEPS
${
OP_HEADER_DEPS
}
${
OP_PREFETCH_DEPS
}
)
register_operators
(
EXCLUDES py_func_op warpctc_op conv_fusion_op DEPS
${
OP_HEADER_DEPS
}
${
OP_PREFETCH_DEPS
}
)
# warpctc_op needs cudnn 7 above
if
(
WITH_GPU AND NOT WIN32
)
...
...
@@ -82,7 +81,7 @@ endif()
# op_library(unstack_op DEPS stack_op)
# op_library(tensor_array_to_tensor_op DEPS concat_op)
set
(
OPERATOR_DEPS
${
OPERATOR_DEPS
}
${
COMMON_OP_DEPS
}
python pybind
)
set
(
OPERATOR_DEPS
${
OPERATOR_DEPS
}
${
COMMON_OP_DEPS
}
)
set
(
GLOB_OPERATOR_DEPS
${
OPERATOR_DEPS
}
CACHE INTERNAL
"Global Op dependencies"
)
cc_test
(
gather_test SRCS gather_test.cc DEPS tensor
)
...
...
@@ -94,4 +93,8 @@ cc_test(save_load_op_test SRCS save_load_op_test.cc DEPS save_op load_op)
cc_test
(
save_load_combine_op_test SRCS save_load_combine_op_test.cc DEPS save_combine_op load_combine_op
)
nv_test
(
dropout_op_test SRCS dropout_op_test.cc DEPS dropout_op tensor
)
if
(
WITH_PYTHON
)
cc_library
(
py_func_op SRCS py_func_op.cc DEPS op_registry python pybind
)
endif
()
set
(
GLOB_OP_LIB
${
OP_LIBRARY
}
CACHE INTERNAL
"Global OP library"
)
paddle/fluid/operators/py_func_op.cc
浏览文件 @
deb0d41c
...
...
@@ -22,7 +22,7 @@
namespace
paddle
{
namespace
operators
{
namespace
py
=
pybind11
;
namespace
py
=
::
pybind11
;
static
std
::
vector
<
py
::
object
>
g_py_callables
;
...
...
@@ -30,7 +30,7 @@ const char kForwardPythonCallableId[] = "forward_callable_id";
const
char
kBackwardPythonCallableId
[]
=
"backward_callable_id"
;
const
char
kPyFuncBackwardSkipVars
[]
=
"backward_skip_vars"
;
size_t
AppendPythonCallableObjectAndReturnId
(
py
::
object
py_obj
)
{
size_t
AppendPythonCallableObjectAndReturnId
(
const
py
::
object
&
py_obj
)
{
g_py_callables
.
emplace_back
(
py_obj
);
return
g_py_callables
.
size
()
-
1
;
}
...
...
paddle/fluid/operators/py_func_op.h
浏览文件 @
deb0d41c
...
...
@@ -19,7 +19,7 @@
namespace
paddle
{
namespace
operators
{
size_t
AppendPythonCallableObjectAndReturnId
(
pybind11
::
object
py_obj
);
size_t
AppendPythonCallableObjectAndReturnId
(
const
::
pybind11
::
object
&
py_obj
);
}
// namespace operators
}
// namespace paddle
paddle/fluid/pybind/CMakeLists.txt
浏览文件 @
deb0d41c
set
(
PYBIND_DEPS pybind python proto_desc memory executor async_executor prune feed_fetch_method pass_builder parallel_executor profiler layer
)
if
(
WITH_PYTHON
)
list
(
APPEND PYBIND_DEPS py_func_op
)
endif
()
set
(
PYBIND_SRCS pybind.cc exception.cc protobuf.cc const_value.cc recordio.cc async_executor_py.cc imperative.cc
)
if
(
WITH_PYTHON
)
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
deb0d41c
...
...
@@ -9173,31 +9173,22 @@ class PyFuncWrapper(object):
kwargs
[
arg
]
=
args
[
idx
]
idx
+=
1
ret0
=
self
.
_func
(
*
args
[
idx
:],
**
kwargs
)
if
ret0
is
None
:
return
None
if
not
isinstance
(
ret0
,
(
list
,
tuple
)):
ret0
=
(
ret0
,
)
func_ret
=
self
.
_func
(
*
args
[
idx
:],
**
kwargs
)
if
not
isinstance
(
func_ret
,
(
list
,
tuple
)):
func_ret
=
(
func_ret
,
)
ret
=
[]
for
i
in
six
.
moves
.
range
(
len
(
ret0
)):
if
ret0
[
i
]
is
None
:
ret
.
append
(
None
)
continue
if
isinstance
(
ret0
[
i
],
core
.
LoDTensor
):
ret
.
append
(
ret0
[
i
])
for
each_ret
in
func_ret
:
if
each_ret
is
None
or
isinstance
(
each_ret
,
core
.
LoDTensor
):
ret
.
append
(
each_ret
)
continue
if
isinstance
(
ret0
[
i
],
np
.
ndarray
):
r
=
ret0
[
i
]
else
:
r
=
np
.
array
(
ret0
[
i
])
if
not
isinstance
(
each_ret
,
np
.
ndarray
):
each_ret
=
np
.
array
(
each_ret
)
t
=
core
.
LoDTensor
()
t
.
set
(
r
,
core
.
CPUPlace
())
ret
.
append
(
t
)
t
ensor
=
core
.
LoDTensor
()
t
ensor
.
set
(
each_ret
,
core
.
CPUPlace
())
ret
.
append
(
t
ensor
)
return
tuple
(
ret
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录