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
Lucas Miranda
deepOF
Commits
14a77ace
Commit
14a77ace
authored
Jun 03, 2020
by
lucas_miranda
Browse files
Added KL and MMD warmup draft in SEQ2SEQ_VAE and SEQ2SEQ_VAEP models
parent
ced17a62
Changes
1
Hide whitespace changes
Inline
Side-by-side
source/model_utils.py
View file @
14a77ace
...
...
@@ -129,7 +129,7 @@ class KLDivergenceLayer(Layer):
kL_batch
=
-
0.5
*
K
.
sum
(
1
+
log_var
-
K
.
square
(
mu
)
-
K
.
exp
(
log_var
),
axis
=-
1
)
self
.
add_loss
(
beta
*
K
.
mean
(
kL_batch
),
inputs
=
inputs
)
self
.
add_loss
(
self
.
beta
*
K
.
mean
(
kL_batch
),
inputs
=
inputs
)
return
inputs
...
...
@@ -148,6 +148,6 @@ class MMDiscrepancyLayer(Layer):
true_samples
=
K
.
random_normal
(
K
.
shape
(
z
))
mmd_batch
=
compute_mmd
(
true_samples
,
z
)
self
.
add_loss
(
beta
*
K
.
mean
(
mmd_batch
),
inputs
=
z
)
self
.
add_loss
(
self
.
beta
*
K
.
mean
(
mmd_batch
),
inputs
=
z
)
return
z
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