无法访问 theano 共享变量

Cannot access theano shared variable

我创建了一些共享变量并将它们放在一个数组中,如下所示:

self.params = [self.We, self.Wr, self.Wv, self.b]

当我试图在代码的另一部分获取它们的值时,是这样的:

self.h = [theano.shared(value=p.get_value()*0.) for p in self.params]

我收到此错误:

AttributeError: 'TensorVariable' object has no attribute 'get_value'

非常感谢任何帮助。

问题是,尽管我使用了共享 api,但我还使用 .astype(theano.config.floatX) 转换为 float32,这导致从 sharedVariable 转换为 tensorVariable