Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSeg
提交
8f77b383
P
PaddleSeg
项目概览
PaddlePaddle
/
PaddleSeg
通知
285
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8f77b383
编写于
9月 22, 2020
作者:
M
michaelowenliu
提交者:
GitHub
9月 22, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #395 from wuyefeilin/dygraph
update layer_libs.py
上级
88c25c7f
a960fe3e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
16 deletion
+14
-16
dygraph/paddleseg/models/common/layer_libs.py
dygraph/paddleseg/models/common/layer_libs.py
+14
-16
未找到文件。
dygraph/paddleseg/models/common/layer_libs.py
浏览文件 @
8f77b383
...
...
@@ -20,18 +20,18 @@ from paddle.nn import Conv2d
from
paddle.nn
import
SyncBatchNorm
as
BatchNorm
class
ConvBNRe
lu
(
nn
.
Layer
):
class
ConvBNRe
LU
(
nn
.
Layer
):
def
__init__
(
self
,
in_channels
,
out_channels
,
kernel_size
,
**
kwargs
):
super
(
ConvBNRe
lu
,
self
).
__init__
()
super
(
ConvBNRe
LU
,
self
).
__init__
()
self
.
conv
=
Conv2d
(
in_channels
,
out_channels
,
kernel_size
,
**
kwargs
)
self
.
_
conv
=
Conv2d
(
in_channels
,
out_channels
,
kernel_size
,
**
kwargs
)
self
.
batch_norm
=
BatchNorm
(
out_channels
)
self
.
_
batch_norm
=
BatchNorm
(
out_channels
)
def
forward
(
self
,
x
):
x
=
self
.
conv
(
x
)
x
=
self
.
batch_norm
(
x
)
x
=
self
.
_
conv
(
x
)
x
=
self
.
_
batch_norm
(
x
)
x
=
F
.
relu
(
x
)
return
x
...
...
@@ -40,14 +40,12 @@ class ConvBN(nn.Layer):
def
__init__
(
self
,
in_channels
,
out_channels
,
kernel_size
,
**
kwargs
):
super
(
ConvBN
,
self
).
__init__
()
self
.
conv
=
Conv2d
(
in_channels
,
out_channels
,
kernel_size
,
**
kwargs
)
self
.
batch_norm
=
BatchNorm
(
out_channels
)
self
.
_conv
=
Conv2d
(
in_channels
,
out_channels
,
kernel_size
,
**
kwargs
)
self
.
_batch_norm
=
BatchNorm
(
out_channels
)
def
forward
(
self
,
x
):
x
=
self
.
conv
(
x
)
x
=
self
.
batch_norm
(
x
)
x
=
self
.
_
conv
(
x
)
x
=
self
.
_
batch_norm
(
x
)
return
x
...
...
@@ -69,16 +67,16 @@ class ConvReluPool(nn.Layer):
return
x
class
DepthwiseConvBNRe
lu
(
nn
.
Layer
):
class
DepthwiseConvBNRe
LU
(
nn
.
Layer
):
def
__init__
(
self
,
in_channels
,
out_channels
,
kernel_size
,
**
kwargs
):
super
(
DepthwiseConvBNRe
lu
,
self
).
__init__
()
super
(
DepthwiseConvBNRe
LU
,
self
).
__init__
()
self
.
depthwise_conv
=
ConvBN
(
in_channels
,
out_channels
=
in_channels
,
kernel_size
=
kernel_size
,
groups
=
in_channels
,
**
kwargs
)
self
.
piontwise_conv
=
ConvBNRe
lu
(
self
.
piontwise_conv
=
ConvBNRe
LU
(
in_channels
,
out_channels
,
kernel_size
=
1
,
groups
=
1
)
def
forward
(
self
,
x
):
...
...
@@ -105,7 +103,7 @@ class AuxLayer(nn.Layer):
dropout_prob
=
0.1
):
super
(
AuxLayer
,
self
).
__init__
()
self
.
conv_bn_relu
=
ConvBNRe
lu
(
self
.
conv_bn_relu
=
ConvBNRe
LU
(
in_channels
=
in_channels
,
out_channels
=
inter_channels
,
kernel_size
=
3
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录