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?
Hi @Sadheesh_S & Welcome to the Tensorflow forum.
The below codes are not working on the new version of TensorFlow.
Can you please show the error message your are getting?
Hi @Sadheesh_S ,
You can use this code:
# 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.
And for more detailed follow this github issue.
I hope it helps!
Thanks for your reply.
The below exception has mentioned for your reference:
AttributeErrorr: module ‘tensorflow’ has no attribute ‘GPUOptions’
Moreoever, the facial recognition code using the session.run() from tf. session
I’m not sure how to refactor the legacy code with new version of tensorflow
Thanks again for your valuable support.
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.
tf.compat.v1 classes allow you to run your TF1.x code using TF2.x, e.g. tf.compat.v1.Session.