I used the following codes to set the backend of keras to Theano:
import os os.environ["KERAS_BACKEND"] = "theano" import keras.backend keras.backend.set_image_dim_ordering('th')
And also tried this:
!sed -i 's/tensorflow/theano/' ~/.keras/keras.json # !sed -i 's/last/first/' ~/.keras/keras.json !cat ~/.keras/keras.json
Then I checked the backend:
I have no idea what went wrong, could someone give me some suggestions? Thank you!
Source: Python Questions