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
vision
Commits
e1a30427
Unverified
Commit
e1a30427
authored
May 05, 2020
by
Bisakh Mondal
Committed by
GitHub
May 05, 2020
Browse files
Updated with weight initialization warnings (#2170)
parent
6f849df0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
torchvision/models/googlenet.py
torchvision/models/googlenet.py
+6
-1
torchvision/models/inception.py
torchvision/models/inception.py
+6
-1
No files found.
torchvision/models/googlenet.py
View file @
e1a30427
...
...
@@ -62,11 +62,16 @@ def googlenet(pretrained=False, progress=True, **kwargs):
class
GoogLeNet
(
nn
.
Module
):
__constants__
=
[
'aux_logits'
,
'transform_input'
]
def
__init__
(
self
,
num_classes
=
1000
,
aux_logits
=
True
,
transform_input
=
False
,
init_weights
=
Tru
e
,
def
__init__
(
self
,
num_classes
=
1000
,
aux_logits
=
True
,
transform_input
=
False
,
init_weights
=
Non
e
,
blocks
=
None
):
super
(
GoogLeNet
,
self
).
__init__
()
if
blocks
is
None
:
blocks
=
[
BasicConv2d
,
Inception
,
InceptionAux
]
if
init_weights
is
None
:
warnings
.
warn
(
'The default weight initialization of GoogleNet will be changed in future releases of '
'torchvision. If you wish to keep the old behavior (which leads to long initialization times'
' due to scipy/scipy#11299), please set init_weights=True.'
,
FutureWarning
)
init_weights
=
True
assert
len
(
blocks
)
==
3
conv_block
=
blocks
[
0
]
inception_block
=
blocks
[
1
]
...
...
torchvision/models/inception.py
View file @
e1a30427
...
...
@@ -63,13 +63,18 @@ def inception_v3(pretrained=False, progress=True, **kwargs):
class
Inception3
(
nn
.
Module
):
def
__init__
(
self
,
num_classes
=
1000
,
aux_logits
=
True
,
transform_input
=
False
,
inception_blocks
=
None
,
init_weights
=
Tru
e
):
inception_blocks
=
None
,
init_weights
=
Non
e
):
super
(
Inception3
,
self
).
__init__
()
if
inception_blocks
is
None
:
inception_blocks
=
[
BasicConv2d
,
InceptionA
,
InceptionB
,
InceptionC
,
InceptionD
,
InceptionE
,
InceptionAux
]
if
init_weights
is
None
:
warnings
.
warn
(
'The default weight initialization of inception_v3 will be changed in future releases of '
'torchvision. If you wish to keep the old behavior (which leads to long initialization times'
' due to scipy/scipy#11299), please set init_weights=True.'
,
FutureWarning
)
init_weights
=
True
assert
len
(
inception_blocks
)
==
7
conv_block
=
inception_blocks
[
0
]
inception_a
=
inception_blocks
[
1
]
...
...
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