Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
1529b82c
Unverified
Commit
1529b82c
authored
May 21, 2019
by
Haoyu Zhang
Committed by
GitHub
May 21, 2019
Browse files
Replace GlobalAvgPooling with reduce mean to reduce cross-device overhead (#6837)
parent
76256146
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
official/resnet/keras/resnet_model.py
official/resnet/keras/resnet_model.py
+2
-1
No files found.
official/resnet/keras/resnet_model.py
View file @
1529b82c
...
...
@@ -230,7 +230,8 @@ def resnet50(num_classes, dtype='float32', batch_size=None):
x
=
identity_block
(
x
,
3
,
[
512
,
512
,
2048
],
stage
=
5
,
block
=
'b'
)
x
=
identity_block
(
x
,
3
,
[
512
,
512
,
2048
],
stage
=
5
,
block
=
'c'
)
x
=
layers
.
GlobalAveragePooling2D
(
name
=
'avg_pool'
)(
x
)
rm_axes
=
[
1
,
2
]
if
backend
.
image_data_format
()
==
'channels_last'
else
[
2
,
3
]
x
=
layers
.
Lambda
(
lambda
x
:
backend
.
mean
(
x
,
rm_axes
),
name
=
'reduce_mean'
)(
x
)
x
=
layers
.
Dense
(
num_classes
,
kernel_regularizer
=
regularizers
.
l2
(
L2_WEIGHT_DECAY
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment