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
f63f2a97
Commit
f63f2a97
authored
Oct 09, 2018
by
yl-1993
Browse files
fix flake8 error
parent
8332ddbc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
mmcv/cnn/alexnet.py
mmcv/cnn/alexnet.py
+1
-3
mmcv/cnn/vgg.py
mmcv/cnn/vgg.py
+5
-2
No files found.
mmcv/cnn/alexnet.py
View file @
f63f2a97
...
@@ -12,9 +12,7 @@ class AlexNet(nn.Module):
...
@@ -12,9 +12,7 @@ class AlexNet(nn.Module):
num_classes (int): number of classes for classification.
num_classes (int): number of classes for classification.
"""
"""
def
__init__
(
self
,
num_classes
=-
1
):
def
__init__
(
self
,
num_classes
=-
1
):
super
(
AlexNet
,
self
).
__init__
()
super
(
AlexNet
,
self
).
__init__
()
self
.
num_classes
=
num_classes
self
.
num_classes
=
num_classes
self
.
features
=
nn
.
Sequential
(
self
.
features
=
nn
.
Sequential
(
...
...
mmcv/cnn/vgg.py
View file @
f63f2a97
import
logging
import
logging
import
math
import
torch.nn
as
nn
import
torch.nn
as
nn
...
@@ -118,7 +117,10 @@ class VGG(nn.Module):
...
@@ -118,7 +117,10 @@ class VGG(nn.Module):
elif
pretrained
is
None
:
elif
pretrained
is
None
:
for
m
in
self
.
modules
():
for
m
in
self
.
modules
():
if
isinstance
(
m
,
nn
.
Conv2d
):
if
isinstance
(
m
,
nn
.
Conv2d
):
nn
.
init
.
kaiming_normal_
(
m
.
weight
,
mode
=
'fan_out'
,
nonlinearity
=
'relu'
)
nn
.
init
.
kaiming_normal_
(
m
.
weight
,
mode
=
'fan_out'
,
nonlinearity
=
'relu'
)
if
m
.
bias
is
not
None
:
if
m
.
bias
is
not
None
:
nn
.
init
.
constant_
(
m
.
bias
,
0
)
nn
.
init
.
constant_
(
m
.
bias
,
0
)
elif
isinstance
(
m
,
nn
.
BatchNorm2d
):
elif
isinstance
(
m
,
nn
.
BatchNorm2d
):
...
@@ -131,6 +133,7 @@ class VGG(nn.Module):
...
@@ -131,6 +133,7 @@ class VGG(nn.Module):
raise
TypeError
(
'pretrained must be a str or None'
)
raise
TypeError
(
'pretrained must be a str or None'
)
def
forward
(
self
,
x
):
def
forward
(
self
,
x
):
outs
=
[]
for
i
,
layer_name
in
enumerate
(
self
.
vgg_layers
):
for
i
,
layer_name
in
enumerate
(
self
.
vgg_layers
):
vgg_layer
=
getattr
(
self
,
layer_name
)
vgg_layer
=
getattr
(
self
,
layer_name
)
x
=
vgg_layer
(
x
)
x
=
vgg_layer
(
x
)
...
...
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