I want to alternate the optimization of parameters in the model. However, when the trainable variables are changed in a function decorated with @tf.function, I encounter the error message: "ValueError: tf.function only supports singleton tf.Variables created on the first call. Make sure the tf.Variable is only created once or created outside tf.function." My solution is creating three separate functions for different training stages. Are there any other approaches?
I want to alternate the optimization of parameters in the model. However, when the trainable variables are changed in a function decorated with @tf.function, I encounter the error message: "ValueError: tf.function only supports singleton tf.Variables created on the first call. Make sure the tf.Variable is only created once or created outside tf.function." My solution is creating three separate functions for different training stages. Are there any other approaches?