我从官方的烤宽面条加载了mnist_conv.py示例。从千层面(蟒蛇深度神经网络框架)获取输出
在和,我想预测我自己的例子。我看到“lasagne.layers.get_output()”应该处理来自官方文档的numpy数组,但它不起作用,我无法弄清楚我该怎么做。
这里是我的代码:
if __name__ == '__main__':
output_layer = main() #the output layer from the net
exampleChar = np.zeros((28,28)) #the example I would predict
outputValue = lasagne.layers.get_output(output_layer, exampleChar)
print(outputValue.eval())
,但它给了我:
TypeError: ConvOp (make_node) requires input be a 4D tensor; received "TensorConstant{(28, 28) of 0.0}" (2 dims)
我明白,它需要一个四维张量,但我没有任何想法如何纠正它。
你能帮我吗?谢谢
该示例是一个空白图像?因为np.zeros((28,28))意味着。 – Geeocode
你在输入形状中设置了什么 – Geeocode
是的,因为只是一个例子。我会用我的意图使用其他阵列。 – Jlearner