Faced the same problem. Used:
optimizer=tf.keras.optimizers.Adam()
in place of:
optimizer = tf.train.AdamOptimizer()
inside the compile object
(my tf version is 2.11.0. This method works both for Tf-cpu & Tf-gpu)