From 3440f42a8935558185f84e03e01c47ba03a6dbfe Mon Sep 17 00:00:00 2001 From: Felix Yu Date: Sun, 2 Jul 2017 19:20:04 +0800 Subject: [PATCH] Updated to Keras (2.0.5) and Tensorflow (1.2.1) --- custom_layers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/custom_layers.py b/custom_layers.py index 9038419..c761481 100644 --- a/custom_layers.py +++ b/custom_layers.py @@ -1,6 +1,8 @@ -from keras import initializations from keras.engine import Layer, InputSpec - +try: + from keras import initializations +except ImportError: + from keras import initializers as initializations import keras.backend as K class Scale(Layer): @@ -45,8 +47,8 @@ class Scale(Layer): self.input_spec = [InputSpec(shape=input_shape)] shape = (int(input_shape[self.axis]),) - self.gamma = self.gamma_init(shape, name='{}_gamma'.format(self.name)) - self.beta = self.beta_init(shape, name='{}_beta'.format(self.name)) + self.gamma = K.variable(self.gamma_init(shape), name='{}_gamma'.format(self.name)) + self.beta = K.variable(self.beta_init(shape), name='{}_beta'.format(self.name)) self.trainable_weights = [self.gamma, self.beta] if self.initial_weights is not None: