Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
055fb215
P
Paddle
项目概览
机器未来
/
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看板
提交
055fb215
编写于
3月 28, 2018
作者:
F
fengjiayi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove unnecessary 'force_cpu'
上级
6dfc33c2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
5 addition
and
9 deletion
+5
-9
python/paddle/fluid/layers/control_flow.py
python/paddle/fluid/layers/control_flow.py
+2
-4
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+1
-2
python/paddle/fluid/tests/book/test_machine_translation.py
python/paddle/fluid/tests/book/test_machine_translation.py
+1
-1
python/paddle/fluid/tests/unittests/test_profiler.py
python/paddle/fluid/tests/unittests/test_profiler.py
+1
-2
未找到文件。
python/paddle/fluid/layers/control_flow.py
浏览文件 @
055fb215
...
@@ -1357,8 +1357,7 @@ class DynamicRNN(object):
...
@@ -1357,8 +1357,7 @@ class DynamicRNN(object):
self
.
lod_rank_table
=
None
self
.
lod_rank_table
=
None
self
.
max_seq_len
=
None
self
.
max_seq_len
=
None
self
.
step_idx
=
None
self
.
step_idx
=
None
self
.
zero_idx
=
fill_constant
(
self
.
zero_idx
=
fill_constant
(
shape
=
[
1
],
value
=
0
,
dtype
=
'int64'
)
shape
=
[
1
],
value
=
0
,
dtype
=
'int64'
,
force_cpu
=
True
)
self
.
mem_dict
=
dict
()
self
.
mem_dict
=
dict
()
self
.
output_array
=
[]
self
.
output_array
=
[]
self
.
outputs
=
[]
self
.
outputs
=
[]
...
@@ -1434,8 +1433,7 @@ class DynamicRNN(object):
...
@@ -1434,8 +1433,7 @@ class DynamicRNN(object):
def
block
(
self
):
def
block
(
self
):
if
self
.
status
!=
DynamicRNN
.
BEFORE_RNN
:
if
self
.
status
!=
DynamicRNN
.
BEFORE_RNN
:
raise
ValueError
(
"rnn.block() can only be invoke once"
)
raise
ValueError
(
"rnn.block() can only be invoke once"
)
self
.
step_idx
=
fill_constant
(
self
.
step_idx
=
fill_constant
(
shape
=
[
1
],
dtype
=
'int64'
,
value
=
0
)
shape
=
[
1
],
dtype
=
'int64'
,
value
=
0
,
force_cpu
=
True
)
self
.
step_idx
.
stop_gradient
=
False
self
.
step_idx
.
stop_gradient
=
False
self
.
status
=
DynamicRNN
.
IN_RNN
self
.
status
=
DynamicRNN
.
IN_RNN
with
self
.
while_op
.
block
():
with
self
.
while_op
.
block
():
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
055fb215
...
@@ -3306,8 +3306,7 @@ def autoincreased_step_counter(counter_name=None, begin=1, step=1):
...
@@ -3306,8 +3306,7 @@ def autoincreased_step_counter(counter_name=None, begin=1, step=1):
name
=
counter_name
,
dtype
=
'int64'
,
shape
=
[
1
],
persistable
=
True
)
name
=
counter_name
,
dtype
=
'int64'
,
shape
=
[
1
],
persistable
=
True
)
if
is_new_var
:
if
is_new_var
:
helper
.
set_variable_initializer
(
helper
.
set_variable_initializer
(
counter
,
initializer
=
Constant
(
counter
,
initializer
=
Constant
(
value
=
begin
-
1
))
value
=
begin
-
1
,
force_cpu
=
True
))
helper
.
main_program
.
global_block
().
prepend_op
(
helper
.
main_program
.
global_block
().
prepend_op
(
type
=
'increment'
,
type
=
'increment'
,
inputs
=
{
'X'
:
[
counter
]},
inputs
=
{
'X'
:
[
counter
]},
...
...
python/paddle/fluid/tests/book/test_machine_translation.py
浏览文件 @
055fb215
...
@@ -83,7 +83,7 @@ def decoder_train(context, is_sparse):
...
@@ -83,7 +83,7 @@ def decoder_train(context, is_sparse):
def
decoder_decode
(
context
,
is_sparse
):
def
decoder_decode
(
context
,
is_sparse
):
init_state
=
context
init_state
=
context
array_len
=
pd
.
fill_constant
(
shape
=
[
1
],
dtype
=
'int64'
,
value
=
max_length
)
array_len
=
pd
.
fill_constant
(
shape
=
[
1
],
dtype
=
'int64'
,
value
=
max_length
)
counter
=
pd
.
zeros
(
shape
=
[
1
],
dtype
=
'int64'
,
force_cpu
=
True
)
counter
=
pd
.
zeros
(
shape
=
[
1
],
dtype
=
'int64'
)
# fill the first element with init_state
# fill the first element with init_state
state_array
=
pd
.
create_array
(
'float32'
)
state_array
=
pd
.
create_array
(
'float32'
)
...
...
python/paddle/fluid/tests/unittests/test_profiler.py
浏览文件 @
055fb215
...
@@ -33,8 +33,7 @@ class TestProfiler(unittest.TestCase):
...
@@ -33,8 +33,7 @@ class TestProfiler(unittest.TestCase):
image
=
fluid
.
layers
.
data
(
name
=
'x'
,
shape
=
[
784
],
dtype
=
'float32'
)
image
=
fluid
.
layers
.
data
(
name
=
'x'
,
shape
=
[
784
],
dtype
=
'float32'
)
hidden1
=
fluid
.
layers
.
fc
(
input
=
image
,
size
=
64
,
act
=
'relu'
)
hidden1
=
fluid
.
layers
.
fc
(
input
=
image
,
size
=
64
,
act
=
'relu'
)
i
=
layers
.
zeros
(
shape
=
[
1
],
dtype
=
'int64'
)
i
=
layers
.
zeros
(
shape
=
[
1
],
dtype
=
'int64'
)
counter
=
fluid
.
layers
.
zeros
(
counter
=
fluid
.
layers
.
zeros
(
shape
=
[
1
],
dtype
=
'int64'
)
shape
=
[
1
],
dtype
=
'int64'
,
force_cpu
=
True
)
until
=
layers
.
fill_constant
([
1
],
dtype
=
'int64'
,
value
=
10
)
until
=
layers
.
fill_constant
([
1
],
dtype
=
'int64'
,
value
=
10
)
data_arr
=
layers
.
array_write
(
hidden1
,
i
)
data_arr
=
layers
.
array_write
(
hidden1
,
i
)
cond
=
fluid
.
layers
.
less_than
(
x
=
counter
,
y
=
until
)
cond
=
fluid
.
layers
.
less_than
(
x
=
counter
,
y
=
until
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录