Theano 报错:No suitable SharedVariable constructor could be found. Are you sure all kwargs are supported? We do not support the parameter dtype or type

当Theano报错:No suitable SharedVariable constructor could be found. Are you sure all kwargs are supported?

解决方案:在把变量变成数组类型变量

源代码:

self.W = theano.shared(value = W, borrow = True) 
self.b = theano.shared(value = b, borrow = True)

修改为:

self.W = theano.shared(value = numpy.asarray(W), borrow = True)    # 原本代码为:value = W, 修改为:value = numpy.asarray(W)
self.b = theano.shared(value = numpy.asarray(b), borrow = True)

也可以尝试另外一种方案:
去掉borrow = True(逗号也要去掉哦)

 

posted @ 2019-10-21 21:03  重大的小鸿  阅读(276)  评论(0编辑  收藏  举报