Mercurial > pylearn
annotate pylearn/sandbox/test_scan_inputs_groups.py @ 1223:621e03253f0c
mini-bug in taglist
author | boulanni <nicolas_boulanger@hotmail.com> |
---|---|
date | Wed, 22 Sep 2010 15:08:39 -0400 |
parents | d1a757d17e19 |
children |
rev | line source |
---|---|
790
d98117100166
fix FillMissing debug mode error. The error was caused by the fact that debug_mode generate an error by default for NaN value. We must disable this check for this op as we deal with NaN value.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
775
diff
changeset
|
1 import sys, time, unittest, copy |
769
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
2 |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
3 import numpy,time |
769
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
4 import numpy as N |
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
5 |
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
6 from theano.tests import unittest_tools as utt |
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
7 |
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
8 from theano import function, Mode |
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
9 import theano.tensor as T |
773
a25d2229a091
remove something that should not have been commited.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
772
diff
changeset
|
10 from pylearn.sandbox.scan_inputs_groups import FillMissing |
790
d98117100166
fix FillMissing debug mode error. The error was caused by the fact that debug_mode generate an error by default for NaN value. We must disable this check for this op as we deal with NaN value.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
775
diff
changeset
|
11 import theano.compile.mode as mode_module |
906 | 12 import theano |
769
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
13 |
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
14 class TestFillMissing(unittest.TestCase): |
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
15 def setUp(self): |
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
16 utt.seed_rng() |
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
17 |
790
d98117100166
fix FillMissing debug mode error. The error was caused by the fact that debug_mode generate an error by default for NaN value. We must disable this check for this op as we deal with NaN value.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
775
diff
changeset
|
18 #we need to desactivate the check for NaN value as we have them in input |
d98117100166
fix FillMissing debug mode error. The error was caused by the fact that debug_mode generate an error by default for NaN value. We must disable this check for this op as we deal with NaN value.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
775
diff
changeset
|
19 #TODO: Make an option to don't check NaN value in input only, bug check in output. |
906 | 20 m=mode_module.get_default_mode() |
21 if isinstance(m,theano.compile.debugmode.DebugMode): | |
22 m=copy.copy(m) | |
790
d98117100166
fix FillMissing debug mode error. The error was caused by the fact that debug_mode generate an error by default for NaN value. We must disable this check for this op as we deal with NaN value.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
775
diff
changeset
|
23 m.check_isfinite=False |
d98117100166
fix FillMissing debug mode error. The error was caused by the fact that debug_mode generate an error by default for NaN value. We must disable this check for this op as we deal with NaN value.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
775
diff
changeset
|
24 self.mode = m |
d98117100166
fix FillMissing debug mode error. The error was caused by the fact that debug_mode generate an error by default for NaN value. We must disable this check for this op as we deal with NaN value.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
775
diff
changeset
|
25 |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
26 def test_vector(self): |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
27 print "test_vector" |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
28 n=100000 |
769
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
29 v=T.dvector() |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
30 def t(prob,val,fill): |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
31 op=FillMissing(fill)(v) |
790
d98117100166
fix FillMissing debug mode error. The error was caused by the fact that debug_mode generate an error by default for NaN value. We must disable this check for this op as we deal with NaN value.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
775
diff
changeset
|
32 f=function([v],op,mode=self.mode) |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
33 nb_missing=0 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
34 for i in range(n): |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
35 if prob[i]<0.1: |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
36 nb_missing+=1 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
37 val[i]=N.nan |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
38 t=time.time() |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
39 out=f(val) |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
40 print "time %.3fs"%(time.time()-t) |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
41 for i in range(n): |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
42 if N.isnan(val[i]): |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
43 if isinstance(fill,N.ndarray): |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
44 assert abs(out[0][i]-fill[i])<1e-6 |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
45 else: |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
46 assert out[0][i]==fill |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
47 else: |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
48 assert out[0][i]==val[i] |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
49 assert out[1][i]==1 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
50 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
51 prob=N.random.random(n) |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
52 val=N.random.random(n) |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
53 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
54 fill=0 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
55 t(prob,val,fill)#test with fill a constant |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
56 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
57 fill=N.random.random(n) |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
58 t(prob,val,fill)#test with fill a vector |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
59 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
60 #TODO: test fill_with_array! |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
61 def test_matrix(self): |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
62 print "test_matrix" |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
63 shp=(100,10) |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
64 v=T.dmatrix() |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
65 def t(prob,val,fill): |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
66 op=FillMissing(fill)(v) |
790
d98117100166
fix FillMissing debug mode error. The error was caused by the fact that debug_mode generate an error by default for NaN value. We must disable this check for this op as we deal with NaN value.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
775
diff
changeset
|
67 f=function([v],op,mode=self.mode) |
769
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
68 |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
69 nb_missing=0 |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
70 for i in range(shp[0]): |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
71 for j in range(shp[1]): |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
72 if prob[i,j]<0.1: |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
73 nb_missing+=1 |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
74 val[i,j]=N.nan |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
75 t=time.time() |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
76 out=f(val) |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
77 print "time %.3fs"%(time.time()-t) |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
78 for i in range(shp[0]): |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
79 for j in range(shp[1]): |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
80 if N.isnan(val[i,j]): |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
81 if isinstance(fill,N.ndarray): |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
82 assert abs(out[0][i,j]-fill[j])<1e-6 |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
83 else: |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
84 assert out[0][i,j]==fill |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
85 else: |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
86 assert out[0][i,j]==val[i,j] |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
87 assert out[1][i,j]==1 |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
88 |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
89 |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
90 prob=N.random.random(N.prod(shp)).reshape(shp) |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
91 val=N.random.random(shp) |
769
0ff7ac3253b3
added test for FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff
changeset
|
92 |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
93 fill=0 |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
94 t(prob,val,fill)#test with fill a constant |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
95 |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
96 fill=N.random.random(shp[1]) |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
97 t(prob,val,fill)#test with fill a vector |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
98 |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
99 #TODO: test fill_with_array! |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
100 def test_matrix3d(self): |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
101 print "test_matrix3d" |
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
102 shp=(10,100,100) |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
103 v= T.TensorType('float64', (False, False, False))() |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
104 op=FillMissing()(v) |
790
d98117100166
fix FillMissing debug mode error. The error was caused by the fact that debug_mode generate an error by default for NaN value. We must disable this check for this op as we deal with NaN value.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
775
diff
changeset
|
105 fct=function([v],op,mode=self.mode) |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
106 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
107 prob=N.random.random(N.prod(shp)).reshape(shp) |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
108 val=N.random.random(prob.shape) |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
109 nb_missing=0 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
110 for i in range(shp[0]): |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
111 for j in range(shp[1]): |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
112 for k in range(shp[2]): |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
113 if prob[i,j,k]<0.1: |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
114 nb_missing+=1 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
115 val[i,j,k]=N.nan |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
116 t=time.time() |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
117 out=fct(val) |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
118 print "time %.3fs"%(time.time()-t) |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
119 for i in range(shp[0]): |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
120 for j in range(shp[1]): |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
121 for k in range(shp[2]): |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
122 if N.isnan(val[i,j,k]): |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
123 assert out[0][i,j,k]==0 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
124 assert out[1][i,j,k]==0 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
125 else: |
775
164a76c8346f
test more case in FillMissing and print the time of the op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
773
diff
changeset
|
126 assert out[0][i,j,k]==val[i,j,k] |
772
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
127 assert out[1][i,j,k]==1 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
128 |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
129 if __name__ == '__main__': |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
130 t = TestFillMissing("test_vector") |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
131 t.test_vector() |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
132 # from theano.tests import main |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
133 # main("test_sp") |
33f46eee4a96
added more test for the FillMissing op.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
769
diff
changeset
|
134 |