Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Oneflow-Inc
OneFlow-Benchmark
提交
c5277630
O
OneFlow-Benchmark
项目概览
Oneflow-Inc
/
OneFlow-Benchmark
上一次同步 接近 3 年
通知
1
Star
92
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OneFlow-Benchmark
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c5277630
编写于
6月 01, 2020
作者:
M
mir-of
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix conv2d_layer
上级
49dc6b01
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
48 addition
and
1 deletion
+48
-1
cnn_e2e/model_util.py
cnn_e2e/model_util.py
+48
-1
未找到文件。
cnn_e2e/model_util.py
浏览文件 @
c5277630
...
...
@@ -17,7 +17,14 @@ def conv2d_layer(
weight_initializer
=
flow
.
random_uniform_initializer
(),
bias_initializer
=
flow
.
constant_initializer
(),
):
weight_shape
=
(
filters
,
input
.
shape
[
1
],
kernel_size
,
kernel_size
)
if
isinstance
(
kernel_size
,
int
):
kernel_size_1
=
kernel_size
kernel_size_2
=
kernel_size
if
isinstance
(
kernel_size
,
list
):
kernel_size_1
=
kernel_size
[
0
]
kernel_size_2
=
kernel_size
[
1
]
weight_shape
=
(
filters
,
input
.
shape
[
1
],
kernel_size_1
,
kernel_size_2
)
weight
=
flow
.
get_variable
(
name
+
"-weight"
,
shape
=
weight_shape
,
...
...
@@ -43,3 +50,43 @@ def conv2d_layer(
raise
NotImplementedError
return
output
def
conv2d_layer_with_bn
(
name
,
input
,
filters
,
kernel_size
=
3
,
strides
=
1
,
padding
=
"SAME"
,
data_format
=
"NCHW"
,
dilation_rate
=
1
,
activation
=
"Relu"
,
use_bias
=
True
,
weight_initializer
=
flow
.
random_uniform_initializer
(),
bias_initializer
=
flow
.
constant_initializer
(),
use_bn
=
True
,
):
output
=
conv2d_layer
(
name
=
name
,
input
=
input
,
filters
=
filters
,
kernel_size
=
kernel_size
,
strides
=
strides
,
padding
=
padding
,
data_format
=
data_format
,
dilation_rate
=
dilation_rate
,
activation
=
activation
,
use_bias
=
use_bias
,
weight_initializer
=
weight_initializer
,
bias_initializer
=
bias_initializer
)
if
use_bn
:
output
=
flow
.
layers
.
batch_normalization
(
inputs
=
output
,
axis
=
1
,
momentum
=
0.997
,
epsilon
=
1.001e-5
,
center
=
True
,
scale
=
True
,
trainable
=
True
,
name
=
name
+
"_bn"
)
return
output
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录