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
OpenDAS
MMCV
Commits
466a6c82
Unverified
Commit
466a6c82
authored
Mar 03, 2022
by
Xiangxu-0103
Committed by
GitHub
Mar 03, 2022
Browse files
[Fix] fix deconv_flops_counter_hooker (#1760)
* fix deconv_flops_counter * Update generalized_attention.py
parent
ea64b512
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
mmcv/cnn/bricks/generalized_attention.py
mmcv/cnn/bricks/generalized_attention.py
+1
-1
mmcv/cnn/utils/flops_counter.py
mmcv/cnn/utils/flops_counter.py
+1
-1
No files found.
mmcv/cnn/bricks/generalized_attention.py
View file @
466a6c82
...
@@ -351,7 +351,7 @@ class GeneralizedAttention(nn.Module):
...
@@ -351,7 +351,7 @@ class GeneralizedAttention(nn.Module):
repeat
(
n
,
1
,
1
,
1
)
repeat
(
n
,
1
,
1
,
1
)
position_feat_x_reshape
=
position_feat_x
.
\
position_feat_x_reshape
=
position_feat_x
.
\
view
(
n
,
num_heads
,
w
*
w_kv
,
self
.
qk_embed_dim
)
view
(
n
,
num_heads
,
w
*
w_kv
,
self
.
qk_embed_dim
)
position_feat_y_reshape
=
position_feat_y
.
\
position_feat_y_reshape
=
position_feat_y
.
\
view
(
n
,
num_heads
,
h
*
h_kv
,
self
.
qk_embed_dim
)
view
(
n
,
num_heads
,
h
*
h_kv
,
self
.
qk_embed_dim
)
...
...
mmcv/cnn/utils/flops_counter.py
View file @
466a6c82
...
@@ -459,7 +459,7 @@ def deconv_flops_counter_hook(conv_module, input, output):
...
@@ -459,7 +459,7 @@ def deconv_flops_counter_hook(conv_module, input, output):
bias_flops
=
0
bias_flops
=
0
if
conv_module
.
bias
is
not
None
:
if
conv_module
.
bias
is
not
None
:
output_height
,
output_width
=
output
.
shape
[
2
:]
output_height
,
output_width
=
output
.
shape
[
2
:]
bias_flops
=
out_channels
*
batch_size
*
output_height
*
output_
height
bias_flops
=
out_channels
*
batch_size
*
output_height
*
output_
width
overall_flops
=
overall_conv_flops
+
bias_flops
overall_flops
=
overall_conv_flops
+
bias_flops
conv_module
.
__flops__
+=
int
(
overall_flops
)
conv_module
.
__flops__
+=
int
(
overall_flops
)
...
...
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