diff test_mlp.py @ 183:25d0a0c713da

did some debugging of test_mlp
author Olivier Breuleux <breuleuo@iro.umontreal.ca>
date Tue, 13 May 2008 18:30:08 -0400
parents 2698c0feeb54
children 562f308873f0
line wrap: on
line diff
--- a/test_mlp.py	Tue May 13 17:00:53 2008 -0400
+++ b/test_mlp.py	Tue May 13 18:30:08 2008 -0400
@@ -2,8 +2,56 @@
 from mlp import *
 import dataset
 
+
+from functools import partial
+def separator(debugger, i, node, *ths):
+    print "==================="
+
+def what(debugger, i, node, *ths):
+    print "#%i" % i, node
+
+def parents(debugger, i, node, *ths):
+    print [input.step for input in node.inputs]
+
+def input_shapes(debugger, i, node, *ths):
+    print "input shapes: ",
+    for r in node.inputs:
+        if hasattr(r.value, 'shape'):
+            print r.value.shape,
+        else:
+            print "no_shape",
+    print
+
+def input_types(debugger, i, node, *ths):
+    print "input types: ",
+    for r in node.inputs:
+        print r.type,
+    print
+
+def output_shapes(debugger, i, node, *ths):
+    print "output shapes:",
+    for r in node.outputs:
+        if hasattr(r.value, 'shape'):
+            print r.value.shape,
+        else:
+            print "no_shape",
+    print
+
+def output_types(debugger, i, node, *ths):
+    print "output types:",
+    for r in node.outputs:
+        print r.type,
+    print
+
+
 def test0():
-    nnet = OneHiddenLayerNNetClassifier(10,2,.001,1000)
+    linker = 'c|py'
+    #linker = partial(theano.gof.DebugLinker, linkers = [theano.gof.OpWiseCLinker],
+    #                 debug_pre = [separator, what, parents, input_types, input_shapes],
+    #                 debug_post = [output_shapes, output_types],
+    #                 compare_fn = lambda x, y: numpy.all(x == y))
+    
+    nnet = OneHiddenLayerNNetClassifier(10,2,.001,1000, linker = linker)
     training_set = dataset.ArrayDataSet(numpy.array([[0, 0, 0],
                                                      [0, 1, 1],
                                                      [1, 0, 1],