#NEWLINE# def perform( self , node , inp , out ) : #NEWLINE# #INDENT# ( x , ) = inp #NEWLINE# ( z , ) = out #NEWLINE# if self . inverse : #NEWLINE# #INDENT# if ( len ( x . shape ) != ( ( self . n_dims_before + len ( self . dims_neighbourhoods ) ) + 1 ) ) : #NEWLINE# #INDENT# raise ValueError ( "Images passed as input don't match the dimensions passed when this (inversed) Apply node was created" ) #NEWLINE# #UNINDENT# prod = 1 #NEWLINE# for dim in self . dims_neighbourhoods : #NEWLINE# #INDENT# prod *= dim #NEWLINE# #UNINDENT# if ( x . shape [ ( - 1 ) ] != inp ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Last dimension of neighbourhoods (%s) is not the product of the neighbourhoods dimensions (%s)' % ( str ( x . shape [ ( - 1 ) ] ) , str ( prod ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( x . shape ) != ( self . n_dims_before + len ( self . dims_neighbourhoods ) ) ) : #NEWLINE# #INDENT# raise ValueError ( "Images passed as input don't match the dimensions passed when this Apply node was created" ) #NEWLINE# #UNINDENT# #UNINDENT# if self . inverse : #NEWLINE# #INDENT# ( input_shape , num_strides ) = self . in_shape ( x . shape ) #NEWLINE# ( out_shape , dummy ) = self . out_shape ( input_shape ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# input_shape = x . shape #NEWLINE# ( out_shape , num_strides ) = self . out_shape ( input_shape ) #NEWLINE# #UNINDENT# if ( z [ 0 ] is None ) : #NEWLINE# #INDENT# if self . inverse : #NEWLINE# #INDENT# z [ 0 ] = numpy . zeros ( input_shape ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# z [ 0 ] = numpy . zeros ( out_shape ) #NEWLINE# #UNINDENT# z [ 0 ] = theano . _asarray ( z [ 0 ] , dtype = x . dtype ) #NEWLINE# #UNINDENT# exec ( self . code )