Please make sure that the boxes below are checked before you submit your issue.
If your issue is an implementation question, please ask your question on StackOverflow or on the Keras Slack channel instead of opening a GitHub issue.
Thank you!
[ x] Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/keras-team/keras.git --upgrade --no-deps
[x ] Check that your version of TensorFlow is up-to-date. The installation instructions can be found here.
[x] Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).
Here is the model I'm trying to train
from keras import backend as K
from keras.layers import Layer
import keras.initializers
class EmbeddingMax(Layer):
def __init__(self ,**kwargs):
super(EmbeddingMax, self).__init__(**kwargs)
def build(self, input_shape):
# Create a trainable weight variable for this layer.
self.kernel = self.add_weight(name='kernel',
shape=(input_shape[1],input_shape[2]),
initializer=keras.initializers.Zeros(),
trainable=True)
super(EmbeddingMax, self).build(input_shape) # Be sure to call this at the end
def call(self, x):
return x+self.kernel
def change_trainable(self, value):
self.kernel.trainable=value
def compute_output_shape(self, input_shape):
return input_shape
I need embmax to be False on the first training, but when the model finishes training I need to set it to true. The thing is it won't change the number of trainable params. And if I try to set embmax.kernel.trainable=False I get AttributeError: can't set attribute. How do I change the property of that layer.
Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question on StackOverflow or on the Keras Slack channel instead of opening a GitHub issue.
Thank you!
[ x] Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/keras-team/keras.git --upgrade --no-deps
[x ] Check that your version of TensorFlow is up-to-date. The installation instructions can be found here.
[x] Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short). Here is the model I'm trying to train
Class Embmax:
I need embmax to be False on the first training, but when the model finishes training I need to set it to true. The thing is it won't change the number of trainable params. And if I try to set embmax.kernel.trainable=False I get AttributeError: can't set attribute. How do I change the property of that layer.