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
efecf7d1
Unverified
Commit
efecf7d1
authored
Jun 01, 2020
by
Harry
Committed by
GitHub
Jun 01, 2020
Browse files
fix building ConvModule with Tanh activation (#309)
* fix: tanh has not inplace * feat: add ConvModule with Tanh
parent
213156ce
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
mmcv/cnn/bricks/conv_module.py
mmcv/cnn/bricks/conv_module.py
+3
-1
tests/test_cnn/test_conv_module.py
tests/test_cnn/test_conv_module.py
+6
-0
No files found.
mmcv/cnn/bricks/conv_module.py
View file @
efecf7d1
...
...
@@ -139,6 +139,8 @@ class ConvModule(nn.Module):
# build activation layer
if
self
.
with_activation
:
act_cfg_
=
act_cfg
.
copy
()
# nn.Tanh has no 'inplace' argument
if
act_cfg_
[
'type'
]
!=
'Tanh'
:
act_cfg_
.
setdefault
(
'inplace'
,
inplace
)
self
.
activate
=
build_activation_layer
(
act_cfg_
)
...
...
tests/test_cnn/test_conv_module.py
View file @
efecf7d1
...
...
@@ -117,6 +117,12 @@ def test_conv_module():
output
=
conv
(
x
)
assert
output
.
shape
==
(
1
,
8
,
256
,
256
)
# tanh
conv
=
ConvModule
(
3
,
8
,
3
,
padding
=
1
,
act_cfg
=
dict
(
type
=
'Tanh'
))
assert
isinstance
(
conv
.
activate
,
nn
.
Tanh
)
output
=
conv
(
x
)
assert
output
.
shape
==
(
1
,
8
,
256
,
256
)
def
test_bias
():
# bias: auto, without norm
...
...
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