报错:TypeError: Cannot convert Type TensorType(int32, matrix) (of Variable Subtensor{int64:int64:}.0) into Type TensorType(int32, vector). You can try to manually convert Subtensor{int64:int64:}.0 into a TensorType(int32, vector).
原因:numpy数组的shape没有转成(-1, )就直接丢给theano用了,1维的numpy数组会被theano认为是matrix,而不是vector。所以需要你先手动转换一下。
解决:
方法一:test_raw_y.flatten()
方法二:test_raw_y.reshape((-1))
感谢:https://theano-users.narkive.com/59N7go8o/re-typeerror-cannot-convert-type-tensortype-int32-matrix-of-variable-subtensor-int64-int64-0-into