When I run my code where I am trying to use tensor flow as backend and I do the following:
import tensorflow
KERAS_BACKEND=tensorflow
import keras
from keras import backend as K
K.tensorflow_backend._get_available_gpus()
I get the following error:
K.tensorflow_backend._get_available_gpus()
AttributeError: module 'keras.backend' has no attribute 'tensorflow_backend'
However, when I run the same piece of code on Jupyter notebook, it works and gives me the following output:
['/job:localhost/replica:0/task:0/device:GPU:0']
And this output means that tensowflow is installed. I don't get it why I get the above mentioned error when I run the same script through terminal. I am in the same environment in both cases. Insights would be appreciated.