when i define my own layers with tf.keras
,like this:
def build(self, input_shape):
self.input_spec = [InputSpec(shape=input_shape)]
shape = (input_shape[self.axis],)
#print('shape:',type(shape))
init_gamma = self.scale * np.ones(shape)
self.gamma = tf.Variable(init_gamma,name='{}_gamma'.format(self.name))
print('type',type([self.gamma]))
self.trainable_weights=[self.gamma]
It raise a bug in the tf/python/keras/base_layer.py
that I can't set the attribute "trainable_weights" likely because it conflicts with:
an existing read-only @property of the object. Please choose a different name
What should I do?