Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
6da552a2
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看板
未验证
提交
6da552a2
编写于
10月 09, 2020
作者:
Z
zhulei
提交者:
GitHub
10月 09, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update initializer examples of Bilinear (#27709)
上级
7ecbc465
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
20 deletion
+21
-20
python/paddle/fluid/initializer.py
python/paddle/fluid/initializer.py
+21
-20
未找到文件。
python/paddle/fluid/initializer.py
浏览文件 @
6da552a2
...
@@ -729,31 +729,32 @@ class BilinearInitializer(Initializer):
...
@@ -729,31 +729,32 @@ class BilinearInitializer(Initializer):
.. code-block:: python
.. code-block:: python
import paddle.fluid as fluid
import math
import math
import paddle
import paddle.nn as nn
from paddle.regularizer import L2Decay
factor = 2
factor = 2
C = 2
C = 2
B = 8
B = 8
H = W = 32
H = W = 32
w_attr = fluid.param_attr.ParamAttr(
w_attr = paddle.ParamAttr(learning_rate=0.,
learning_rate=0.,
regularizer=L2Decay(0.),
regularizer=fluid.regularizer.L2Decay(0.),
initializer=nn.initializer.Bilinear())
initializer=fluid.initializer.Bilinear())
data = paddle.rand([B, 3, H, W], dtype='float32')
x = fluid.data(name="data", shape=[B, 3, H, W],
conv_up = nn.ConvTranspose2d(3,
dtype="float32")
out_channels=C,
conv_up = fluid.layers.conv2d_transpose(
kernel_size=2 * factor - factor % 2,
input=x,
padding=int(
num_filters=C,
math.ceil((factor - 1) / 2.)),
output_size=None,
stride=factor,
filter_size=2 * factor - factor % 2,
weight_attr=w_attr,
padding=int(math.ceil((factor - 1) / 2.)),
bias_attr=False)
stride=factor,
x = conv_up(data)
groups=C,
param_attr=w_attr,
Where, `out_channels=C` and `groups=C` means this is channel-wise transposed
bias_attr=False)
convolution. The filter shape will be (C, 1, K, K) where K is `kernel_size`,
Where, `num_filters=C` and `groups=C` means this is channel-wise transposed
convolution. The filter shape will be (C, 1, K, K) where K is `filer_size`,
This initializer will set a (K, K) interpolation kernel for every channel
This initializer will set a (K, K) interpolation kernel for every channel
of the filter identically. The resulting shape of the output feature map
of the filter identically. The resulting shape of the output feature map
will be (B, C, factor * H, factor * W). Note that the learning rate and the
will be (B, C, factor * H, factor * W). Note that the learning rate and the
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录