2016-04-01 27 views
0

theano/lazanya kullanarak bir CNN uygulamaya çalışıyorum. Nöral bir ağ kurdum ama bunu mevcut durumla nasıl eğiteceğimi anlayamıyorum.Theano/lazanya ile konvolüsyonel sinir ağını eğitin

Ağın çıkışını, giriş olarak current_states ile almaya çalışıyorum.

theano.compile.function_module.UnusedInputError: theano.function was asked to create a function computing outputs given certain inputs, but the provided input variable at index 0 is not part of the computational graph needed to compute the outputs: inputs. 
To make this error into a warning, you can pass the parameter on_unused_input='warn' to theano.function. To disable it completely, use on_unused_input='ignore'. 

Neden current_states kullanılmaz :

train = theano.function([input_var], lasagne.layers.get_output(l.out)) 
output = train(current_states) 

Ancak bu hatayı alıyorum?

Modelin çıktısını current_states üzerinde almak istiyorum. Bunu nasıl yaparım?

cevap

1

Aşağıdaki kod parçacığı benim için çalışıyor:

import lasagne, theano 
import theano.tensor as T 
import numpy as np 
input_var = theano.tensor.tensor4('inputs') 
l_out = build_cnn(input_var) 
train = theano.function([input_var], lasagne.layers.get_output(l_out)) 
x = np.random.randn(10, 4, 80, 80).astype(theano.config.floatX) 
train(x) 

Sen tüm kod sonrası vermedi, ancak komut olmadığını kontrol edebilirsiniz:

( http://pastebin.com/Gd35RncU CNN kodu oluşturmak) input_var değişkeninde build_cnn işlevine geçiyorsunuz. Eğer yapmazsanız, input_var hesaplama grafiğinizin bir parçası olmayacaktır, bu yüzden Theano hatayı artırıyor.

İlgili konular