将Google Colab设置为使用Theano作为后端

时间:2019-06-06 01:27:06

标签: keras theano google-colaboratory

我正在关注一个使用Theano作为后端的在线教程。我正在使用默认为Tensorflow的Google Colab作为后端。

我们如何转换为使用Theano作为后端?谢谢

2 个答案:

答案 0 :(得分:1)

这会有所帮助,

import os
os.environ["KERAS_BACKEND"] = "theano"
import keras.backend
keras.backend.set_image_dim_ordering('th')

答案 1 :(得分:0)

由于keras版本的原因,此处接受的解决方案不再起作用。降级到2.2.4并运行上面的代码:

!pip uninstall keras
!pip install keras==2.2.4

import os

os.environ["KERAS_BACKEND"] = "theano"
import keras.backend
keras.backend.set_image_dim_ordering('th')
相关问题