Moving restore_from_checkpoint to TrainableLayer
@@ -23,12 +23,6 @@ class Layer(object):
def layer_scope(self):
return self._op.variable_scope
- def restore_from_checkpoint(self, checkpoint_name, scope=None):
- if scope is None:
- scope=self.layer_scope().name
- tf.add_to_collection(RESTORABLE,(self.layer_scope().name,
- checkpoint_name,scope))
-
def to_string(self):
layer_scope_name = self.layer_scope().name
out_str = "\033[42m[Layer]\033[0m {}".format(layer_scope_name)
@@ -54,6 +48,12 @@ class TrainableLayer(Layer):
return tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES,
self.layer_scope().name)
+ def restore_from_checkpoint(self, checkpoint_name, scope=None):
+ if scope is None:
+ scope=self.layer_scope().name
+ tf.add_to_collection(RESTORABLE,(self.layer_scope().name,
+ checkpoint_name,scope))
+
def regularizer_loss(self):
return tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES,
self.layer_scope().name)
