sách gpt4 ai đã đi

Không thể nhập local_bitwidth từ Theano trên Google colab khi nhập shared_randomstreams.RandomStreams

In lại 作者:行者123 更新时间:2023-12-05 05:56:53 32 4
mua khóa gpt4 Nike

我在从 'theano.configdefaults' 导入 'local_bitwidth' 时遇到问题。并显示以下消息:

ImportError Traceback (most recent call last)
in ()
39 from theano.tensor.nnet import conv
40 from theano.tensor.nnet import softmax
---> 41 from theano.tensor import shared_randomstreams
42 from theano.tensor.signal.pool import pool_2d
43

7 frames
/usr/local/lib/python3.7/dist-packages/theano/gof/cmodule.py in ()
35 # we will abuse the lockfile mechanism when reading and writing the registry
36 from theano.gof import compilelock
---> 37 from theano.configdefaults import gcc_version_str, local_bitwidth
38
39 importlib = None

ImportError: cannot import name 'local_bitwidth' from 'theano.configdefaults' (/usr/local/lib/python3.7/dist-packages/theano/configdefaults.py)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

我在尝试首先运行此代码时收到此错误:

from theano import function
srng = RandomStreams(seed=234)
rv_u = srng.uniform((2,2))
rv_n = srng.normal((2,2))
f = function([], rv_u)
g = function([], rv_n, no_default_updates=True) #Not updating rv_n.rng
nearly_zeros = function([], rv_u + rv_u - 2 * rv_u)

然后当我运行 Michael Nielsen 书中的卷积神经网络示例时,其中有一行调用 RandomStreams 方法。它们都是我在 google collab 上跑的,有没有办法在 colab 上处理它?

1 Câu trả lời

我昨天遇到了同样的问题,你需要安装 Theano 的 1.0.5 版本,也许你使用的版本与这个版本不同。

在 Google Colab 中:!pip3 卸载theano

并且:!pip3 install theano==1.0.5

关于python - 导入 shared_randomstreams.RandomStreams 时无法从 Google colab 上的 Theano 导入 local_bitwidth,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68962427/

32 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com