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(逗号也要去掉哦)

猜你喜欢

转载自www.cnblogs.com/elitphil/p/11716130.html