I tried to use tf.function to decorate the gradient update function as below.
tf.function
import tensorflow as tf from tensorflow.keras import layers, activation