Skip to content
Snippets Groups Projects
Commit 280dd555 authored by Guillaume HEUSCH's avatar Guillaume HEUSCH
Browse files

[layer] fixed scope issue when using TF version 1.1.0

parent d39a31d8
No related branches found
No related tags found
1 merge request!8Gan
......@@ -76,8 +76,18 @@ class Layer(object):
phase_train:
"""
return tf.contrib.layers.batch_norm(x, decay=1.9, updates_collections=None, epsilon=1e-5, scale=True, is_training=phase_train, scope=scope)
# XXX THAT'S UGLY ...
reuse = False
for var in tf.global_variables():
if scope in var.name and ('beta' in var.name or 'gamma' in var.name):
print "{0} already exists".format(var.name)
reuse = True
if reuse:
return tf.contrib.layers.batch_norm(x, decay=0.9, updates_collections=None, epsilon=1e-5, scale=True, scope=scope, is_training=phase_train, reuse=True)
else:
return tf.contrib.layers.batch_norm(x, decay=0.9, updates_collections=None, epsilon=1e-5, scale=True, scope=scope, is_training=phase_train, reuse=None)
from tensorflow.python.ops import control_flow_ops
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment