Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Andrei-Claudiu Roibu
BrainMapper
Commits
f5eb75d8
Commit
f5eb75d8
authored
Jul 15, 2020
by
Andrei Roibu
Browse files
commented out new weight initialisation for testing
parent
b1633c87
Changes
1
Hide whitespace changes
Inline
Side-by-side
BrainMapperAE.py
View file @
f5eb75d8
...
...
@@ -223,10 +223,10 @@ class BrainMapperAE3D(nn.Module):
for
_
,
subsubmodule
in
submodule
.
named_children
():
if
isinstance
(
subsubmodule
,
(
torch
.
nn
.
PReLU
,
torch
.
nn
.
Dropout3d
,
torch
.
nn
.
MaxPool3d
))
==
False
:
subsubmodule
.
reset_parameters
()
if
isinstance
(
subsubmodule
,
(
torch
.
nn
.
Conv3d
,
torch
.
nn
.
ConvTranspose3d
)):
gain
=
np
.
sqrt
(
np
.
divide
(
2
,
1
+
np
.
power
(
0.25
,
2
)))
fan
,
_
=
calculate_fan
(
subsubmodule
.
weight
)
std
=
np
.
divide
(
gain
,
np
.
sqrt
(
fan
))
subsubmodule
.
weight
.
data
.
normal_
(
0
,
std
)
#
if isinstance(subsubmodule, (torch.nn.Conv3d, torch.nn.ConvTranspose3d)):
#
gain = np.sqrt(np.divide(2, 1 + np.power(0.25, 2)))
#
fan, _ = calculate_fan(subsubmodule.weight)
#
std = np.divide(gain, np.sqrt(fan))
#
subsubmodule.weight.data.normal_(0, std)
print
(
"Initialized network parameters!"
)
\ No newline at end of file
print
(
"Initialized network parameters!"
)
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