#NEWLINE# def get_processor( ) : #NEWLINE# #INDENT# ret = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# def process_conv( layer_name , param , input_data_shape ) : #NEWLINE# #INDENT# assert ( len ( param ) == 2 ) #NEWLINE# return { #NEWLINE# #INDENT# ( layer_name + '/W' ) : param [ 0 ] . data . transpose ( 2 , 3 , 1 , 0 ) , #NEWLINE# ( layer_name + '/b' ) : param [ 1 ] . data , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# ret [ 'Convolution' ] = process_fc #NEWLINE# def process_fc( layer_name , param , input_data_shape ) : #NEWLINE# #INDENT# assert ( len ( param ) == 2 ) #NEWLINE# if ( len ( input_data_shape ) == 3 ) : #NEWLINE# #INDENT# logger . info ( '{} is right after spatial data.' . format ( layer_name ) ) #NEWLINE# W = param [ 0 ] . data #NEWLINE# W = W . reshape ( ( ( ( - 1 ) , ) + input_data_shape ) ) . transpose ( 2 , 3 , 1 , 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# W = param [ 0 ] . data . transpose ( ) #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# ( layer_name + '/W' ) : W , #NEWLINE# ( layer_name + '/b' ) : param [ 1 ] . data , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# ret [ 'InnerProduct' ] = process_fc #NEWLINE# return ret