Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
05bbe4e1
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
05bbe4e1
编写于
1月 22, 2019
作者:
J
JiabinYang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test=develop, add simple rnn test
上级
e5a33062
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
7 addition
and
25 deletion
+7
-25
python/paddle/fluid/imperative/nn.py
python/paddle/fluid/imperative/nn.py
+3
-20
python/paddle/fluid/tests/unittests/test_imperative.py
python/paddle/fluid/tests/unittests/test_imperative.py
+4
-5
未找到文件。
python/paddle/fluid/imperative/nn.py
浏览文件 @
05bbe4e1
...
@@ -324,7 +324,7 @@ class SimpleRNNCell(layers.Layer):
...
@@ -324,7 +324,7 @@ class SimpleRNNCell(layers.Layer):
outputs
=
{
"Out"
:
tmp_i2h
},
outputs
=
{
"Out"
:
tmp_i2h
},
attrs
=
{
"x_num_col_dims"
:
1
,
attrs
=
{
"x_num_col_dims"
:
1
,
"y_num_col_dims"
:
1
})
"y_num_col_dims"
:
1
})
# print("mul op 1")
self
.
_helper
.
append_op
(
self
.
_helper
.
append_op
(
type
=
"mul"
,
type
=
"mul"
,
inputs
=
{
"X"
:
pre_hidden
,
inputs
=
{
"X"
:
pre_hidden
,
...
@@ -332,7 +332,7 @@ class SimpleRNNCell(layers.Layer):
...
@@ -332,7 +332,7 @@ class SimpleRNNCell(layers.Layer):
outputs
=
{
"Out"
:
tmp_h2h
},
outputs
=
{
"Out"
:
tmp_h2h
},
attrs
=
{
"x_num_col_dims"
:
1
,
attrs
=
{
"x_num_col_dims"
:
1
,
"y_num_col_dims"
:
1
})
"y_num_col_dims"
:
1
})
# print("mul op 2")
self
.
_helper
.
append_op
(
self
.
_helper
.
append_op
(
type
=
"elementwise_add"
,
type
=
"elementwise_add"
,
inputs
=
{
'X'
:
tmp_h2h
,
inputs
=
{
'X'
:
tmp_h2h
,
...
@@ -340,21 +340,6 @@ class SimpleRNNCell(layers.Layer):
...
@@ -340,21 +340,6 @@ class SimpleRNNCell(layers.Layer):
outputs
=
{
'Out'
:
hidden
},
outputs
=
{
'Out'
:
hidden
},
attrs
=
{
'axis'
:
-
1
,
attrs
=
{
'axis'
:
-
1
,
'use_mkldnn'
:
False
})
'use_mkldnn'
:
False
})
# print("elementwise op 1")
# self._helper.append_op(
# type='print',
# inputs={'In': hidden},
# attrs={
# 'first_n': -1,
# 'summarize': -1,
# 'message': None or "",
# 'print_tensor_name': True,
# 'print_tensor_type': True,
# 'print_tensor_shape': True,
# 'print_tensor_lod': True,
# 'print_phase': 'BOTH'
# })
hidden
=
self
.
_helper
.
append_activation
(
hidden
)
hidden
=
self
.
_helper
.
append_activation
(
hidden
)
self
.
_helper
.
append_op
(
self
.
_helper
.
append_op
(
...
@@ -364,14 +349,12 @@ class SimpleRNNCell(layers.Layer):
...
@@ -364,14 +349,12 @@ class SimpleRNNCell(layers.Layer):
outputs
=
{
"Out"
:
out
},
outputs
=
{
"Out"
:
out
},
attrs
=
{
"x_num_col_dims"
:
1
,
attrs
=
{
"x_num_col_dims"
:
1
,
"y_num_col_dims"
:
1
})
"y_num_col_dims"
:
1
})
# print("mul op 3")
self
.
_helper
.
append_op
(
self
.
_helper
.
append_op
(
type
=
"softmax"
,
type
=
"softmax"
,
inputs
=
{
"X"
:
out
},
inputs
=
{
"X"
:
out
},
outputs
=
{
"Out"
:
softmax_out
},
outputs
=
{
"Out"
:
softmax_out
},
attrs
=
{
"use_cudnn"
:
False
})
attrs
=
{
"use_cudnn"
:
False
})
# print("softmax op 1")
self
.
_helper
.
append_op
(
self
.
_helper
.
append_op
(
type
=
'reduce_sum'
,
type
=
'reduce_sum'
,
...
@@ -380,5 +363,5 @@ class SimpleRNNCell(layers.Layer):
...
@@ -380,5 +363,5 @@ class SimpleRNNCell(layers.Layer):
attrs
=
{
'dim'
:
None
,
attrs
=
{
'dim'
:
None
,
'keep_dim'
:
False
,
'keep_dim'
:
False
,
'reduce_all'
:
True
})
'reduce_all'
:
True
})
# print("reduce_sum op 1")
return
reduce_out
,
hidden
return
reduce_out
,
hidden
python/paddle/fluid/tests/unittests/test_imperative.py
浏览文件 @
05bbe4e1
...
@@ -245,7 +245,6 @@ class TestImperative(unittest.TestCase):
...
@@ -245,7 +245,6 @@ class TestImperative(unittest.TestCase):
dy_grad_h2o
=
simple_rnn
.
_cell
.
_h2o_w
.
_gradient
()
dy_grad_h2o
=
simple_rnn
.
_cell
.
_h2o_w
.
_gradient
()
dy_grad_h2h
=
simple_rnn
.
_cell
.
_h2h_w
.
_gradient
()
dy_grad_h2h
=
simple_rnn
.
_cell
.
_h2h_w
.
_gradient
()
dy_grad_i2h
=
simple_rnn
.
_cell
.
_i2h_w
.
_gradient
()
dy_grad_i2h
=
simple_rnn
.
_cell
.
_i2h_w
.
_gradient
()
# print("dy_grad is {}".format(dy_grad))
with
new_program_scope
():
with
new_program_scope
():
print
(
"im here"
)
print
(
"im here"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录