1

저는 라자인으로 만들어진 신경망의 출력을 시각화하려고합니다. https://github.com/Lasagne/Lasagne/blob/master/examples/mnist.py 내가 다음 코드 줄을 삽입 한 라인 299theano - 신경망의 출력을 평가하십시오.

이 : 우리가 라인의 모델을 'MLP'를 선택하면

 input_var=inputs 
     prediction=lasagne.layers.get_output(network,input_var) 
     print(prediction.eval()) 
     sys.exit('debug') 

이 완벽하게 작동 은 특히 나는 mnist 예에 대한 코드를 수정 한 234 :

def main(model='mlp', num_epochs=500): 

동안은로 라인 (234)을 변경하여 모델 "CNN '를 선택하면 다음과

def main(model='cnn', num_epochs=500): 

라인

print(prediction.eval())  

오류 제공합니다

Traceback (most recent call last): 
    File "/dos/mnist_lasagne_original.py", line 364, in <module> 
main(**kwargs) 
    File "/dos/mnist_lasagne_original.py", line 299, in main 
print(prediction.eval()) 
    File "/usr/local/lib/python2.7/dist-packages/theano/gof/graph.py", line 523, in eval 
rval = self._fn_cache[inputs](*args) 
    File "/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", line 871, in __call__ 
storage_map=getattr(self.fn, 'storage_map', None)) 
    File "/usr/local/lib/python2.7/dist-packages/theano/gof/link.py", line 314, in raise_with_op 
reraise(exc_type, exc_value, exc_trace) 
    File "/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", line 859, in __call__ 
outputs = self.fn() 
ValueError: CorrMM received weight with wrong type. 
Apply node that caused the error: CorrMM{valid, (1, 1)}(TensorConstant{[[[[ 0. 0..0. 0.]]]]}, Subtensor{::, ::, ::int64, ::int64}.0) 
Toposort index: 8 
Inputs types: [TensorType(float32, (False, True, False, False)), TensorType(float64, 4D)] 
Inputs shapes: [(500, 1, 28, 28), (32, 1, 5, 5)] 
Inputs strides: [(3136, 3136, 112, 4), (200, 200, -40, -8)] 
Inputs values: ['not shown', 'not shown'] 
Outputs clients: [[Elemwise{Composite{(i0 * (Abs((i1 + i2)) + i1 + i2))}}(TensorConstant{(1, 1, 1, 1) of 0.5}, CorrMM{valid, (1, 1)}.0, InplaceDimShuffle{x,0,x,x}.0)]] 

Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer): 
    File "/dos/mnist_lasagne_original.py", line 364, in <module> 
main(**kwargs) 
    File "/dos/mnist_lasagne_original.py", line 298, in main 
prediction=lasagne.layers.get_output(network,input_var) 
    File "/home/paul/src/lasagne/lasagne/layers/helper.py", line 185, in get_output 
all_outputs[layer] = layer.get_output_for(layer_inputs, **kwargs) 
    File "/home/paul/src/lasagne/lasagne/layers/conv.py", line 257, in get_output_for 
conved = self.convolve(input, **kwargs) 
    File "/home/paul/src/lasagne/lasagne/layers/conv.py", line 535, in convolve 
filter_flip=self.flip_filters) 

나는 많은 구글이와 나는이 문제의 출처를 알아낼 수 없습니다입니다. 신경 네트워크의 출력을 시각화하여 작동 원리를 이해하는 데 관심이 있습니다. 도움이 될 것입니다.

답변