一、版本: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