view misc_theano.py @ 354:d580b3a369a4

dataset__call__() returns a FieldsSubsetDataSet, so still a subset of fields, but not cached any more. I added the function dataset.cached_fields_subset(self,*fieldnames) that returns the old version, cached, in case someone needs it. Current behaviour passes the tests.
author Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca>
date Thu, 19 Jun 2008 12:35:41 -0400
parents 2480024bf401
children
line wrap: on
line source


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