Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
neural_filters
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
software
neural_filters
Commits
eebe3e0c
Commit
eebe3e0c
authored
Feb 28, 2018
by
Francois Marelli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better initialization
parent
dc3243af
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
7 deletions
+32
-7
neural_filters/NeuralFilter1P.py
neural_filters/NeuralFilter1P.py
+2
-2
neural_filters/NeuralFilter2CC.py
neural_filters/NeuralFilter2CC.py
+12
-3
neural_filters/NeuralFilter2CD.py
neural_filters/NeuralFilter2CD.py
+3
-0
neural_filters/NeuralFilter2R.py
neural_filters/NeuralFilter2R.py
+10
-0
neural_filters/NeuralFilterCell.py
neural_filters/NeuralFilterCell.py
+5
-2
No files found.
neural_filters/NeuralFilter1P.py
View file @
eebe3e0c
...
...
@@ -53,12 +53,12 @@ class NeuralFilter1P(NeuralFilterCell):
s
=
'{name}({input_size},{hidden_size})'
return
s
.
format
(
name
=
self
.
__class__
.
__name__
,
**
self
.
__dict__
)
def
reset_parameters
(
self
):
def
reset_parameters
(
self
,
init
=
None
):
stdv
=
1.0
/
math
.
sqrt
(
self
.
hidden_size
)
for
weight
in
self
.
parameters
():
weight
.
data
.
uniform_
(
-
stdv
,
stdv
)
super
(
NeuralFilter1P
,
self
).
reset_parameters
()
super
(
NeuralFilter1P
,
self
).
reset_parameters
(
init
)
def
check_forward_input
(
self
,
input
):
if
input
.
size
(
-
1
)
!=
self
.
input_size
:
...
...
neural_filters/NeuralFilter2CC.py
View file @
eebe3e0c
...
...
@@ -48,9 +48,18 @@ class NeuralFilter2CC(torch.nn.Module):
self
.
reset_parameters
()
def
reset_parameters
(
self
):
self
.
bias_modulus
.
data
.
zero_
()
self
.
bias_theta
.
data
.
zero_
()
def
reset_parameters
(
self
,
init
=
None
):
if
init
is
None
:
self
.
bias_modulus
.
data
.
zero_
()
self
.
bias_theta
.
data
.
zero_
()
else
:
if
isinstance
(
init
,
tuple
):
self
.
bias_modulus
.
data
.
fill_
(
init
[
0
])
self
.
bias_theta
.
data
.
fill_
(
init
[
1
])
else
:
self
.
bias_theta
.
data
.
fill_
(
init
)
self
.
bias_modulus
.
data
.
fill_
(
init
)
def
__repr__
(
self
):
s
=
'{name}({hidden_size})'
...
...
neural_filters/NeuralFilter2CD.py
View file @
eebe3e0c
...
...
@@ -44,6 +44,9 @@ class NeuralFilter2CD (torch.nn.Module):
self
.
cell
=
NeuralFilterCell
(
self
.
hidden_size
)
def
reset_parameters
(
self
,
init
=
None
):
self
.
cell
.
reset_parameters
(
init
)
def
__repr__
(
self
):
s
=
'{name}({hidden_size})'
return
s
.
format
(
name
=
self
.
__class__
.
__name__
,
**
self
.
__dict__
)
...
...
neural_filters/NeuralFilter2R.py
View file @
eebe3e0c
...
...
@@ -45,6 +45,16 @@ class NeuralFilter2R (torch.nn.Module):
self
.
first_cell
=
NeuralFilterCell
(
self
.
hidden_size
)
self
.
second_cell
=
NeuralFilterCell
(
self
.
hidden_size
)
self
.
reset_parameters
((
-
0.5
,
0.5
))
def
reset_parameters
(
self
,
init
=
None
):
if
isinstance
(
init
,
tuple
):
self
.
first_cell
.
reset_parameters
(
init
[
0
])
self
.
second_cell
.
reset_parameters
(
init
[
1
])
else
:
self
.
first_cell
.
reset_parameters
(
init
)
self
.
second_cell
.
reset_parameters
(
init
)
def
__repr__
(
self
):
s
=
'{name}({hidden_size})'
return
s
.
format
(
name
=
self
.
__class__
.
__name__
,
**
self
.
__dict__
)
...
...
neural_filters/NeuralFilterCell.py
View file @
eebe3e0c
...
...
@@ -47,8 +47,11 @@ class NeuralFilterCell(torch.nn.Module):
self
.
reset_parameters
()
def
reset_parameters
(
self
):
self
.
bias_forget
.
data
.
zero_
()
def
reset_parameters
(
self
,
init
=
None
):
if
init
is
None
:
self
.
bias_forget
.
data
.
zero_
()
else
:
self
.
bias_forget
.
data
.
fill_
(
init
)
def
__repr__
(
self
):
s
=
'{name}({hidden_size})'
...
...
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