我有简单的代码,如下所示:
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)
Run Code Online (Sandbox Code Playgroud)
但是,我收到以下错误信息:
ValueError: setting an array element with a sequence.
Run Code Online (Sandbox Code Playgroud)
此外,当我使用theano.tensor的函数时,似乎它返回的内容称为"tensor",我不能简单地将它切换到numpy.array类型,即使结果应该像矩阵一样形状.
所以这是我的问题:如何切换outxx键入numpy.array?