Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
21c49469
Commit
21c49469
authored
Jan 22, 2019
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix BatchNorm+fp16 in inference mode
parent
56dd2390
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
tensorpack/models/batch_norm.py
tensorpack/models/batch_norm.py
+5
-0
No files found.
tensorpack/models/batch_norm.py
View file @
21c49469
...
@@ -183,6 +183,11 @@ def BatchNorm(inputs, axis=None, training=None, momentum=0.9, epsilon=1e-5,
...
@@ -183,6 +183,11 @@ def BatchNorm(inputs, axis=None, training=None, momentum=0.9, epsilon=1e-5,
tf_args
[
'virtual_batch_size'
]
=
virtual_batch_size
tf_args
[
'virtual_batch_size'
]
=
virtual_batch_size
else
:
else
:
assert
virtual_batch_size
is
None
,
"Feature not supported in this version of TF!"
assert
virtual_batch_size
is
None
,
"Feature not supported in this version of TF!"
use_fp16
=
inputs
.
dtype
==
tf
.
float16
if
use_fp16
:
# non-fused does not support fp16; fused does not support all layouts.
# we made our best guess here
tf_args
[
'fused'
]
=
True
layer
=
tf
.
layers
.
BatchNormalization
(
**
tf_args
)
layer
=
tf
.
layers
.
BatchNormalization
(
**
tf_args
)
xn
=
layer
.
apply
(
inputs
,
training
=
training
,
scope
=
tf
.
get_variable_scope
())
xn
=
layer
.
apply
(
inputs
,
training
=
training
,
scope
=
tf
.
get_variable_scope
())
...
...
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