diff mlp.py @ 127:f959ad58facc

Automated merge with ssh://p-omega1@lgcm.iro.umontreal.ca/tlearn
author Yoshua Bengio <bengioy@iro.umontreal.ca>
date Wed, 07 May 2008 16:58:06 -0400
parents 4efe6d36c061
children 4c2280edcaf5
line wrap: on
line diff
--- a/mlp.py	Wed May 07 16:22:28 2008 -0400
+++ b/mlp.py	Wed May 07 16:58:06 2008 -0400
@@ -71,13 +71,13 @@
         self.learning_rate = learning_rate # this is the float
         self._learning_rate = t.scalar('learning_rate') # this is the symbol
         self._input = t.matrix('input') # n_examples x n_inputs
-        self._target = t.matrix('target','int32') # n_examples x n_outputs
+        self._target = t.ivector('target') # n_examples x n_outputs
         self._L2_regularizer = t.scalar('L2_regularizer')
         self._W1 = t.matrix('W1')
         self._W2 = t.matrix('W2')
         self._b1 = t.row('b1')
         self._b2 = t.row('b2')
-        self._regularization_term = self._L2_regularizer * (t.dot(self._W1,self._W1) + t.dot(self._W2,self._W2))
+        self._regularization_term = self._L2_regularizer * (t.sum(self._W1*self._W1) + t.sum(self._W2*self._W2))
         self._output_activations =self._b2+t.dot(t.tanh(self._b1+t.dot(self._input,self._W1.T)),self._W2.T)
         self._nll,self._output = crossentropy_softmax_1hot(self._output_activations,self._target)
         self._output_class = t.argmax(self._output,1)