prevent overriding training and bn_training attributes by removing them from layer's params dictionary.
@@ -124,8 +124,9 @@ class LayernGPU(Layer):
self.set_input_shape(self.input_shape)
keys_after = self.__dict__.keys()
if self.params_names is None:
- self.params_names = list(keys_after)
- # TODO: training and bn_training
+ # Prevent overriding training and bn_training
+ self.params_names = [k for k in keys_after if isinstance(
+ self.__dict__[k], tf.Variable)]
params = dict([(k, self.__dict__[k]) for k in self.params_names])
self.params_device[device_name] = params
