Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
65f953a6
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
65f953a6
编写于
8月 07, 2017
作者:
F
fengjiayi
提交者:
GitHub
8月 07, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3142 from Canpio/dev_add_FillZerosLikeOp_test
Add unittest for FillZerosLikeOp
上级
d1cda903
e7b3e139
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
25 addition
and
7 deletion
+25
-7
paddle/framework/CMakeLists.txt
paddle/framework/CMakeLists.txt
+1
-0
paddle/framework/pybind.cc
paddle/framework/pybind.cc
+1
-0
paddle/operators/fill_zeros_like_op.cc
paddle/operators/fill_zeros_like_op.cc
+0
-2
paddle/operators/fill_zeros_like_op.cu
paddle/operators/fill_zeros_like_op.cu
+1
-0
paddle/operators/fill_zeros_like_op.h
paddle/operators/fill_zeros_like_op.h
+3
-4
paddle/pybind/CMakeLists.txt
paddle/pybind/CMakeLists.txt
+2
-1
python/paddle/v2/framework/tests/CMakeLists.txt
python/paddle/v2/framework/tests/CMakeLists.txt
+1
-0
python/paddle/v2/framework/tests/test_fill_zeros_like_op.py
python/paddle/v2/framework/tests/test_fill_zeros_like_op.py
+16
-0
未找到文件。
paddle/framework/CMakeLists.txt
浏览文件 @
65f953a6
...
...
@@ -43,4 +43,5 @@ cc_library(paddle_pybind SHARED
add_op
mean_op
cross_entropy_op
fill_zeros_like_op
recurrent_op
)
paddle/framework/pybind.cc
浏览文件 @
65f953a6
...
...
@@ -40,6 +40,7 @@ USE_OP(mean);
USE_OP
(
sigmoid
);
USE_OP
(
softmax
);
USE_OP
(
rowwise_add
);
USE_OP
(
fill_zeros_like
);
USE_OP_WITHOUT_KERNEL
(
recurrent_op
);
namespace
paddle
{
namespace
framework
{
...
...
paddle/operators/fill_zeros_like_op.cc
浏览文件 @
65f953a6
...
...
@@ -13,8 +13,6 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/operators/fill_zeros_like_op.h"
#include "paddle/framework/op_registry.h"
#include "paddle/framework/tensor.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/operators/fill_zeros_like_op.cu
浏览文件 @
65f953a6
...
...
@@ -12,6 +12,7 @@
See the License for the specific language governing permissions and
limitations under the License. */
#define EIGEN_USE_GPU
#include "paddle/framework/op_registry.h"
#include "paddle/operators/fill_zeros_like_op.h"
...
...
paddle/operators/fill_zeros_like_op.h
浏览文件 @
65f953a6
...
...
@@ -13,9 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include "glog/logging.h"
#include "paddle/framework/eigen.h"
#include "paddle/framework/operator.h"
#include "paddle/operators/type_alias.h"
namespace
paddle
{
namespace
operators
{
...
...
@@ -26,7 +24,8 @@ class FillZerosLikeKernel : public framework::OpKernel {
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
auto
*
output
=
context
.
Output
<
framework
::
Tensor
>
(
0
);
output
->
mutable_data
<
T
>
(
context
.
GetPlace
());
framework
::
EigenVector
<
T
>::
Flatten
(
*
output
).
setZero
();
auto
t
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
output
);
t
.
device
(
context
.
GetEigenDevice
<
Place
>
())
=
t
.
constant
(
T
(
0
));
}
};
...
...
paddle/pybind/CMakeLists.txt
浏览文件 @
65f953a6
...
...
@@ -6,4 +6,5 @@ cc_library(paddle_pybind SHARED
add_op
mean_op
cross_entropy_op
recurrent_op
)
recurrent_op
fill_zeros_like_op
)
python/paddle/v2/framework/tests/CMakeLists.txt
浏览文件 @
65f953a6
...
...
@@ -13,6 +13,7 @@ py_test(test_protobuf SRCS test_protobuf.py)
py_test
(
test_add_two_op SRCS test_add_two_op.py
)
py_test
(
test_sigmoid_op SRCS test_sigmoid_op.py
)
py_test
(
test_softmax_op SRCS test_softmax_op.py
)
py_test
(
test_fill_zeros_like_op SRCS test_fill_zeros_like_op.py
)
py_test
(
gradient_checker SRCS gradient_checker.py
)
...
...
python/paddle/v2/framework/tests/test_fill_zeros_like_op.py
0 → 100644
浏览文件 @
65f953a6
import
unittest
from
op_test_util
import
OpTestMeta
import
numpy
class
TestFillZerosLikeOp
(
unittest
.
TestCase
):
__metaclass__
=
OpTestMeta
def
setUp
(
self
):
self
.
type
=
"fill_zeros_like"
self
.
inputs
=
{
'Src'
:
numpy
.
random
.
random
((
219
,
232
)).
astype
(
"float32"
)}
self
.
outputs
=
{
'Dst'
:
numpy
.
zeros_like
(
self
.
inputs
[
'Src'
])}
if
__name__
==
'__main__'
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录