refactor for tf 1.4
from abc import ABCMeta
import tensorflow as tf
+from distutils.version import LooseVersion
class Model(object):
@@ -68,10 +69,12 @@ class Model(object):
Provides access to the model's parameters.
:return: A list of all Variables defining the model parameters.
"""
+ # For tf 1.4 - in which executing_eagerly throws an error.
+ try:
if tf.executing_eagerly():
- raise NotImplementedError("For Eager execution - get_params must "
- "be overridden.")
- else:
+ raise NotImplementedError("For Eager execution - get_params "
+ "must be overridden.")
+ except AttributeError:
scope_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES,
self.scope)
return scope_vars
