comparison 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
comparison
equal deleted inserted replaced
182:4afb41e61fcf 183:25d0a0c713da
1 1
2 from mlp import * 2 from mlp import *
3 import dataset 3 import dataset
4 4
5
6 from functools import partial
7 def separator(debugger, i, node, *ths):
8 print "==================="
9
10 def what(debugger, i, node, *ths):
11 print "#%i" % i, node
12
13 def parents(debugger, i, node, *ths):
14 print [input.step for input in node.inputs]
15
16 def input_shapes(debugger, i, node, *ths):
17 print "input shapes: ",
18 for r in node.inputs:
19 if hasattr(r.value, 'shape'):
20 print r.value.shape,
21 else:
22 print "no_shape",
23 print
24
25 def input_types(debugger, i, node, *ths):
26 print "input types: ",
27 for r in node.inputs:
28 print r.type,
29 print
30
31 def output_shapes(debugger, i, node, *ths):
32 print "output shapes:",
33 for r in node.outputs:
34 if hasattr(r.value, 'shape'):
35 print r.value.shape,
36 else:
37 print "no_shape",
38 print
39
40 def output_types(debugger, i, node, *ths):
41 print "output types:",
42 for r in node.outputs:
43 print r.type,
44 print
45
46
5 def test0(): 47 def test0():
6 nnet = OneHiddenLayerNNetClassifier(10,2,.001,1000) 48 linker = 'c|py'
49 #linker = partial(theano.gof.DebugLinker, linkers = [theano.gof.OpWiseCLinker],
50 # debug_pre = [separator, what, parents, input_types, input_shapes],
51 # debug_post = [output_shapes, output_types],
52 # compare_fn = lambda x, y: numpy.all(x == y))
53
54 nnet = OneHiddenLayerNNetClassifier(10,2,.001,1000, linker = linker)
7 training_set = dataset.ArrayDataSet(numpy.array([[0, 0, 0], 55 training_set = dataset.ArrayDataSet(numpy.array([[0, 0, 0],
8 [0, 1, 1], 56 [0, 1, 1],
9 [1, 0, 1], 57 [1, 0, 1],
10 [1, 1, 1]]), 58 [1, 1, 1]]),
11 {'input':slice(2),'target':2}) 59 {'input':slice(2),'target':2})