Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
dadbe454
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看板
未验证
提交
dadbe454
编写于
6月 15, 2018
作者:
X
Xin Pan
提交者:
GitHub
6月 15, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11511 from panyx0718/doc2
Add doc for while and piecewise_decay op
上级
3a4b6cda
a219f3cc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
9 deletion
+44
-9
python/paddle/fluid/layers/control_flow.py
python/paddle/fluid/layers/control_flow.py
+23
-0
python/paddle/fluid/layers/learning_rate_scheduler.py
python/paddle/fluid/layers/learning_rate_scheduler.py
+21
-9
未找到文件。
python/paddle/fluid/layers/control_flow.py
浏览文件 @
dadbe454
...
@@ -654,6 +654,29 @@ class WhileGuard(BlockGuard):
...
@@ -654,6 +654,29 @@ class WhileGuard(BlockGuard):
class
While
(
object
):
class
While
(
object
):
"""
while loop control flow.
Args:
cond (Variable): condition used to compare.
name (str): The name of this layer.
Examples:
.. code-block:: python
d0 = layers.data("d0", shape=[10], dtype='float32')
data_array = layers.array_write(x=d0, i=i)
array_len = layers.fill_constant(shape=[1],dtype='int64', value=3)
cond = layers.less_than(x=i, y=array_len)
while_op = layers.While(cond=cond)
with while_op.block():
d = layers.array_read(array=data_array, i=i)
i = layers.increment(x=i, in_place=True)
layers.array_write(result, i=i, array=d)
layers.less_than(x=i, y=array_len, cond=cond)
"""
BEFORE_WHILE_BLOCK
=
0
BEFORE_WHILE_BLOCK
=
0
IN_WHILE_BLOCK
=
1
IN_WHILE_BLOCK
=
1
AFTER_WHILE_BLOCK
=
2
AFTER_WHILE_BLOCK
=
2
...
...
python/paddle/fluid/layers/learning_rate_scheduler.py
浏览文件 @
dadbe454
...
@@ -209,15 +209,27 @@ def polynomial_decay(learning_rate,
...
@@ -209,15 +209,27 @@ def polynomial_decay(learning_rate,
def
piecewise_decay
(
boundaries
,
values
):
def
piecewise_decay
(
boundaries
,
values
):
"""Applies piecewise decay to the initial learning rate.
"""Applies piecewise decay to the initial learning rate.
>>> boundaries = [10000, 20000]
The algorithm can be described as the code below.
>>> values = [1.0, 0.5, 0.1]
>>>
.. code-block:: python
>>> if step < 10000:
>>> learning_rate = 1.0
boundaries = [10000, 20000]
>>> elif 10000 <= step < 20000:
values = [1.0, 0.5, 0.1]
>>> learning_rate = 0.5
if step < 10000:
>>> else:
learning_rate = 1.0
>>> learning_rate = 0.1
elif 10000 <= step < 20000:
learning_rate = 0.5
else:
learning_rate = 0.1
Args:
boundaries: A list of steps numbers.
values: A list of learning rate values that will be picked during
different step boundaries.
Returns:
The decayed learning rate.
"""
"""
if
len
(
values
)
-
len
(
boundaries
)
!=
1
:
if
len
(
values
)
-
len
(
boundaries
)
!=
1
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录