I’m new to ML/tensorflow. Recently, the TensorFlow released the new version of the pipy package ```
pip install tensorflow[and-cuda]. The below codes are not working on the new version of TensorFlow.
Can you share a replacement for the below codes?
# Get the list of available GPU device IDs.
gpu_devices = tf.config.experimental.list_physical_devices('GPU')
# Enable GPU support for the first GPU device.
tf.config.experimental.set_visible_devices([gpu_devices[0]], 'GPU')
That you are migrating from TF1.x to TF2.x is a crucial piece of information indeed.
To migrate your code accordingly, please have a look at this Tensorflow guide.
Alternatively, the tf.compat.v1 classes allow you to run your TF1.x code using TF2.x, e.g. tf.compat.v1.Session.