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
19d2e2ac
Commit
19d2e2ac
authored
Sep 22, 2021
by
Fan Yang
Committed by
A. Unique TensorFlower
Sep 22, 2021
Browse files
Internal change
PiperOrigin-RevId: 398292356
parent
350f4854
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
official/vision/beta/modeling/decoders/nasfpn.py
official/vision/beta/modeling/decoders/nasfpn.py
+8
-4
No files found.
official/vision/beta/modeling/decoders/nasfpn.py
View file @
19d2e2ac
...
...
@@ -228,13 +228,17 @@ class NASFPN(tf.keras.Model):
if
input_level
<
target_level
:
stride
=
int
(
2
**
(
target_level
-
input_level
))
x
=
tf
.
keras
.
layers
.
MaxPool2D
(
return
tf
.
keras
.
layers
.
MaxPool2D
(
pool_size
=
stride
,
strides
=
stride
,
padding
=
'same'
)(
x
)
el
if
input_level
>
target_level
:
if
input_level
>
target_level
:
scale
=
int
(
2
**
(
input_level
-
target_level
))
x
=
spatial_transform_ops
.
nearest_upsampling
(
x
,
scale
=
scale
)
return
spatial_transform_ops
.
nearest_upsampling
(
x
,
scale
=
scale
)
return
x
# Force output x to be the same dtype as mixed precision policy. This avoids
# dtype mismatch when one input (by default float32 dtype) does not meet all
# the above conditions and is output unchanged, while other inputs are
# processed to have different dtype, e.g., using bfloat16 on TPU.
return
tf
.
cast
(
x
,
dtype
=
tf
.
keras
.
layers
.
Layer
().
dtype_policy
.
compute_dtype
)
def
_global_attention
(
self
,
feat0
,
feat1
):
m
=
tf
.
math
.
reduce_max
(
feat0
,
axis
=
[
1
,
2
],
keepdims
=
True
)
...
...
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