annotate misc_theano.py @ 489:bb6bdd3b7ff3

Another bit of documentation
author Joseph Turian <turian@gmail.com>
date Tue, 28 Oct 2008 03:31:36 -0400
parents 2480024bf401
children
rev   line source
327
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
1
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
2 import theano
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
3
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
4 class Print(theano.Op):
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
5 def __init__(self,message=""):
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
6 self.message=message
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
7 self.view_map={0:[0]}
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
8
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
9 def make_node(self,xin):
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
10 xout = xin.type.make_result()
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
11 return theano.Apply(op = self, inputs = [xin], outputs=[xout])
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
12
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
13 def perform(self,node,inputs,output_storage):
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
14 xin, = inputs
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
15 xout, = output_storage
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
16 xout[0] = xin
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
17 print self.message,xin
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
18
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
19 def grad(self,input,output_gradients):
2480024bf401 added file that was missing in commit 9e96fe8b955c
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
diff changeset
20 return output_gradients