How to use tensorflow v2 with directml backend

2.9k views Asked by At

I have a computer with the windows operating system with an amd gpu (rx 5600 xt), and I want to run tensorflow on the gpu. I found "tensorflow-directml" which allows me to run tensorflow on my gpu, but it uses tensorflow 1.14.0. Is there another version of "tensorflow-directml" that uses tensorflow v2, or is there another way to run tensorflow in my gpu?

Thanks, and sorry if I wrote something wrong or inaccurate

2

There are 2 answers

0
moth On BEST ANSWER

Microsoft has announced DirectML-plugin for tensorflow 2 in June this year. Check it out at this link: https://learn.microsoft.com/en-us/windows/ai/directml/gpu-tensorflow-plugin. However I believe for your particular GPU model DirectML-plugin may not be compatible as of yet.

1
AudioBubble On

Is there another version of "tensorflow-directml" that uses tensorflow v2

No, According to pypi, latest release (i.e. on Sep 12, 2020) tensorflow-directml 1.15.3.dev200911 is available for public. For more details please refer this.

To run Tensorflow in GPU on windows

For TensorFlow 1.x (i.e. for releases 1.15 and older, CPU and GPU packages are separate)

pip install tensorflow-gpu==1.15  # GPU

For Tensorflow 2.x (i.e. V2) onwards, pip package includes GPU support for CUDA enabled cards

pip install tensorflow

For more information please refer this.