how to set GPU tensorflow 1.15 code example

Example 1: check if tensorflow gpu is installed

import tensorflow as tf
print(tf.test.gpu_device_name())

Example 2: Tensorflow GPU Installation conda

conda create --name tf_gpu
activate tf_gpu
conda install tensorflow-gpu

Example 3: gpu training tensorflow

import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))

Example 4: tensorflow cant see gpu

$ pip uninstall tensorflow
$ pip install tensorflow-gpu