When you create a TensorFlow variable like this:
alpha = tf.Variable(1.0000, dtype=tf.float32, trainable = False, name="alpha" )
and then want to print it or use it as a regular variable, the most common way is to use variable.numpy(). However, this requires enabling eager execution, which can sometimes interfere with the rest of the code (e.g., in libraries that rely on graph mode). I've found a way to do this without enabling eager execution. You can use this command:
optimized_alpha = model.sess.run(alpha)
instead of this:
optimized_alpha = alpha.numpy()
I hope it helps you
If I'm wrong, correct me please!