我有简单的代码,如下所示:
class testxx(object):
def __init__(self, input):
self.input = input
self.output = T.sum(input)
a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype = np.float32)
classfier = testxx(a)
outxx = classfier.output
outxx = np.asarray(outxx, dtype = np.float32)
但是,我收到以下错误信息:
ValueError: setting an array element with a sequence.
此外,当我使用 theano.tensor 的函数时,它返回的似乎称为“张量”,我不能简单地将其切换为 numpy.array 类型,即使结果应该像矩阵一样。
所以这就是我的问题:如何切换 outxx 以键入 numpy.array?