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
cbb05c59
Commit
cbb05c59
authored
Apr 30, 2017
by
Marat Dukhan
Committed by
Francisco Massa
Apr 30, 2017
Browse files
Use torch.nn.init in SqueezeNet models (#146)
parent
874481f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
torchvision/models/squeezenet.py
torchvision/models/squeezenet.py
+3
-5
No files found.
torchvision/models/squeezenet.py
View file @
cbb05c59
import
math
import
math
import
torch
import
torch
import
torch.nn
as
nn
import
torch.nn
as
nn
import
torch.nn.init
as
init
import
torch.utils.model_zoo
as
model_zoo
import
torch.utils.model_zoo
as
model_zoo
...
@@ -87,13 +88,10 @@ class SqueezeNet(nn.Module):
...
@@ -87,13 +88,10 @@ class SqueezeNet(nn.Module):
for
m
in
self
.
modules
():
for
m
in
self
.
modules
():
if
isinstance
(
m
,
nn
.
Conv2d
):
if
isinstance
(
m
,
nn
.
Conv2d
):
gain
=
2.0
if
m
is
final_conv
:
if
m
is
final_conv
:
m
.
weight
.
data
.
normal_
(
0
,
0.01
)
init
.
normal
(
m
.
weight
.
data
,
mean
=
0.0
,
std
=
0.01
)
else
:
else
:
fan_in
=
m
.
kernel_size
[
0
]
*
m
.
kernel_size
[
1
]
*
m
.
in_channels
init
.
kaiming_uniform
(
m
.
weight
.
data
)
u
=
math
.
sqrt
(
3.0
*
gain
/
fan_in
)
m
.
weight
.
data
.
uniform_
(
-
u
,
u
)
if
m
.
bias
is
not
None
:
if
m
.
bias
is
not
None
:
m
.
bias
.
data
.
zero_
()
m
.
bias
.
data
.
zero_
()
...
...
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