Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
0fa1b2f3
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
0fa1b2f3
编写于
4月 08, 2020
作者:
L
littletomatodonkey
提交者:
GitHub
4月 08, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix initalization and regularization docs (#23492)
上级
17133308
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
8 deletion
+11
-8
python/paddle/fluid/initializer.py
python/paddle/fluid/initializer.py
+7
-4
python/paddle/fluid/regularizer.py
python/paddle/fluid/regularizer.py
+4
-4
未找到文件。
python/paddle/fluid/initializer.py
浏览文件 @
0fa1b2f3
...
...
@@ -133,14 +133,16 @@ class ConstantInitializer(Initializer):
Args:
value (float32): constant value to initialize the variable
force_cpu (bool): place for initialization, if set true, initialization will
be forced on CPU even if executor is set on CUDA. default false.
Examples:
.. code-block:: python
import paddle.fluid as fluid
x = fluid.data(name="data", shape=[
8,
32, 32], dtype="float32")
x = fluid.data(name="data", shape=[32, 32], dtype="float32")
fc = fluid.layers.fc(input=x, size=10,
param_attr=fluid.initializer.Constant(value=2.0))
param_attr=fluid.initializer.Constant
Initializer
(value=2.0))
"""
...
...
@@ -744,15 +746,16 @@ class BilinearInitializer(Initializer):
.. code-block:: python
import paddle.fluid as fluid
import math
factor = 2
C = 2
B = 8
H = W = 32
w_attr = fluid.param_attr.ParamAttr(
learning_rate=0.,
learning_rate=0.,
regularizer=fluid.regularizer.L2Decay(0.),
initializer=fluid.initializer.Bilinear())
x = fluid.data(name="data", shape=[B, 3, H, W],
x = fluid.data(name="data", shape=[B, 3, H, W],
dtype="float32")
conv_up = fluid.layers.conv2d_transpose(
input=x,
...
...
python/paddle/fluid/regularizer.py
浏览文件 @
0fa1b2f3
...
...
@@ -134,8 +134,8 @@ class L2DecayRegularizer(WeightDecayRegularizer):
main_prog = fluid.Program()
startup_prog = fluid.Program()
with fluid.program_guard(main_prog, startup_prog):
data = fluid.
layers.data(name='image', shape=[
3, 28, 28], dtype='float32')
label = fluid.
layers.data(name='label', shape=[
1], dtype='int64')
data = fluid.
data(name='image', shape=[256,
3, 28, 28], dtype='float32')
label = fluid.
data(name='label', shape=[256,
1], dtype='int64')
hidden = fluid.layers.fc(input=data, size=128, act='relu')
prediction = fluid.layers.fc(input=hidden, size=10, act='softmax')
loss = fluid.layers.cross_entropy(input=prediction, label=label)
...
...
@@ -213,8 +213,8 @@ class L1DecayRegularizer(WeightDecayRegularizer):
main_prog = fluid.Program()
startup_prog = fluid.Program()
with fluid.program_guard(main_prog, startup_prog):
data = fluid.
layers.data(name='image', shape=[
3, 28, 28], dtype='float32')
label = fluid.
layers.data(name='label', shape=[
1], dtype='int64')
data = fluid.
data(name='image', shape=[256,
3, 28, 28], dtype='float32')
label = fluid.
data(name='label', shape=[256,
1], dtype='int64')
hidden = fluid.layers.fc(input=data, size=128, act='relu')
prediction = fluid.layers.fc(input=hidden, size=10, act='softmax')
loss = fluid.layers.cross_entropy(input=prediction, label=label)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录