KeyError: ‘The optimizer cannot recognize variable conv_pw_13/kernel:0. This usually means you are trying to call the optimizer to update different parts of the model separately. Please call optimizer.build(variables)
with the full list of trainable variables before the training loop or use legacy optimizer `tf.keras.optimizers.legacy.{self.class.name}.’
Can someone help me to figure out the error, the code is available at git. The project code will help me solve my problem.
Hi @Shamsuddeen_Adamu, In tensorflow 2.11 tf.keras.optimizers.Optimizer
points to a new base class. so you have to use the optimizer with tf.keras.optimizers.legacy
. Thank You
1 Like
Could you please help me view the code from where the error is coming? today is my first day of seeing Tesnsorflow and i want to run this code to guide on a assignment
Hi @Shamsuddeen_Adamu, Change this from tensorflow.keras.optimizers import * to from tensorflow.keras.optimizers.legacy import * . Thank You.
1 Like
Thank you. I appreciate