python安装theano出现AttributeError错误解决办法

一、版本:theano为1.03,numpy为1.16.0,python版本为3.6

二、问题描述:AttributeError: ('The following error happened while compiling the node', Elemwise{Composite{((i0 * i1) + i2)}}(weight, input, bias), '\n', "module 'numpy.core.multiarray' has no attribute '_get_ndarray_c_version'")

解决办法:只需要注释一段代码就行了。

三、示例代码:

#导入需要的库或模块
import theano
from theano import tensor as T
def Use_Theano_Tensor_scalar():#标量
    #初始化张量
    x=T.scalar(name='input',dtype='float32')
    w=T.scalar(name='weight',dtype='float32')
    b=T.scalar(name='bias',dtype='float32')
    z=w*x+b

    #编译程序
    net_input=theano.function(inputs=[w,x,b],outputs=z)
    #执行程序
    print('net_input: %2f'% net_input(2.0,3.0,0.5))
if __name__ == '__main__':
    # Math_compare_Numpy_About_Sin()
    # Tensor_Compare_For()
    # Broadcasting()
    Use_Theano_Tensor_scalar()

四、运行效果:

可能我这个解决办法不是太好,如果有跟好的办法的通同志,欢迎留言讨论。

参考的网址:https://github.com/MichalDanielDobrzanski/DeepLearningPython35/issues/20

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值