Mercurial > pylearn
view misc.py @ 179:9911d2cc3c01
merged
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Tue, 13 May 2008 15:14:04 -0400 |
parents | e9a95e19e6f8 |
children | d7250ee86f72 |
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 def unique_elements_list_intersection(list1,list2): """ Return the unique elements that are in both list1 and list2 (repeated elements in listi will not be duplicated in the result). This should run in O(n1+n2) where n1=|list1|, n2=|list2|. """ return list(set.intersection(set(list1),set(list2)))