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
ModelZoo
ResNet50_tensorflow
Commits
3f7d667e
Commit
3f7d667e
authored
Apr 17, 2018
by
Swaroop Guntupalli
Committed by
Karmel Allison
Apr 17, 2018
Browse files
Bugfix for initialization in autoencoder. (#3477)
parent
ed4e22b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
research/autoencoder/autoencoder_models/Autoencoder.py
research/autoencoder/autoencoder_models/Autoencoder.py
+9
-6
No files found.
research/autoencoder/autoencoder_models/Autoencoder.py
View file @
3f7d667e
...
...
@@ -40,21 +40,24 @@ class Autoencoder(object):
def
_initialize_weights
(
self
):
all_weights
=
dict
()
initializer
=
tf
.
contrib
.
layers
.
xavier_initializer
()
# Encoding network weights
encoder_weights
=
[]
for
layer
in
range
(
len
(
self
.
n_layers
)
-
1
):
w
=
tf
.
Variable
(
autoencoder
.
Utils
.
xavier_init
(
self
.
n_layers
[
layer
],
self
.
n_layers
[
layer
+
1
]))
b
=
tf
.
Variable
(
tf
.
zeros
([
self
.
n_layers
[
layer
+
1
]],
dtype
=
tf
.
float32
))
initializer
((
self
.
n_layers
[
layer
],
self
.
n_layers
[
layer
+
1
]),
dtype
=
tf
.
float32
))
b
=
tf
.
Variable
(
tf
.
zeros
([
self
.
n_layers
[
layer
+
1
]],
dtype
=
tf
.
float32
))
encoder_weights
.
append
({
'w'
:
w
,
'b'
:
b
})
# Recon network weights
recon_weights
=
[]
for
layer
in
range
(
len
(
self
.
n_layers
)
-
1
,
0
,
-
1
):
w
=
tf
.
Variable
(
autoencoder
.
Utils
.
xavier_init
(
self
.
n_layers
[
layer
],
self
.
n_layers
[
layer
-
1
]))
b
=
tf
.
Variable
(
tf
.
zeros
([
self
.
n_layers
[
layer
-
1
]],
dtype
=
tf
.
float32
))
initializer
((
self
.
n_layers
[
layer
],
self
.
n_layers
[
layer
-
1
]),
dtype
=
tf
.
float32
))
b
=
tf
.
Variable
(
tf
.
zeros
([
self
.
n_layers
[
layer
-
1
]],
dtype
=
tf
.
float32
))
recon_weights
.
append
({
'w'
:
w
,
'b'
:
b
})
all_weights
[
'encode'
]
=
encoder_weights
all_weights
[
'recon'
]
=
recon_weights
...
...
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