diff misc_theano.py @ 327:2480024bf401

added file that was missing in commit 9e96fe8b955c
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Mon, 16 Jun 2008 12:57:32 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc_theano.py	Mon Jun 16 12:57:32 2008 -0400
@@ -0,0 +1,20 @@
+
+import theano
+
+class Print(theano.Op):
+    def __init__(self,message=""):
+        self.message=message
+        self.view_map={0:[0]}
+
+    def make_node(self,xin):
+        xout = xin.type.make_result()
+        return theano.Apply(op = self, inputs = [xin], outputs=[xout])
+
+    def perform(self,node,inputs,output_storage):
+        xin, = inputs
+        xout, = output_storage
+        xout[0] = xin
+        print self.message,xin
+
+    def grad(self,input,output_gradients):
+        return output_gradients