【问题标题】:Setting Google Colab to use Theano as Backend将 Google Colab 设置为使用 Theano 作为后端
【发布时间】:2019-06-06 01:27:06
【问题描述】:

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

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

【问题讨论】:

  • 您是否找到了解决 Google Colab 后端更改的方法,因为我需要相同的方法?

标签: keras theano google-colaboratory


【解决方案1】:

这会有所帮助,

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

【讨论】:

  • 我收到以下错误:AttributeError: module 'keras.backend' has no attribute 'set_image_dim_ordering'
  • 你找到答案了吗?我面临同样的错误@JorgeM.LondoñoP。
  • 我使用 keras.backend.common.set_image_dim_ordering('th')
【解决方案2】:

由于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')

【讨论】:

    猜你喜欢
    • 2019-09-25
    • 1970-01-01
    • 1970-01-01
    • 2022-09-27
    • 1970-01-01
    • 1970-01-01
    • 2020-01-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多