Using theano as the backend of keras and still report an TypeError?

  deep-learning, keras, python, theano

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:

But I still got an TypeError when I used keras.layers.load_model:

I have no idea what went wrong, could someone give me some suggestions? Thank you!

Source: Python Questions

LEAVE A COMMENT