#NEWLINE# def __init__( self , in_channels , out_channels , ksize , stride = 1 , pad = 0 , wscale = 1 , bias = 0 , nobias = False , outsize = None , use_cudnn = True , initialW = None , initial_bias = None ) : #NEWLINE# #INDENT# ( kh , kw ) = _pair ( ksize ) #NEWLINE# self . stride = _pair ( stride ) #NEWLINE# self . pad = _pair ( pad ) #NEWLINE# self . outsize = ( ( None , None ) if ( outsize is None ) else outsize ) #NEWLINE# self . use_cudnn = use_cudnn #NEWLINE# W_shape = ( in_channels , out_channels , kh , kw ) #NEWLINE# super ( Deconvolution2D , self ) . __init__ ( W = W_shape ) #NEWLINE# if ( initialW is not None ) : #NEWLINE# #INDENT# assert ( initialW . shape == ( in_channels , out_channels , kh , kw ) ) #NEWLINE# self . W . data [ ... ] = initialW #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . W . data = numpy . random . normal ( 0 , ( wscale * math . sqrt ( ( 1.0 / ( ( kh * kw ) * in_channels ) ) ) ) , ( in_channels , out_channels , kh , kw ) ) . astype ( numpy . float32 ) #NEWLINE# #UNINDENT# if ( initial_bias is not None ) : #NEWLINE# #INDENT# assert ( initial_bias . shape == ( out_channels , ) ) #NEWLINE# self . add_param ( 'b' , out_channels ) #NEWLINE# self . b . data [ ... ] = initial_bias #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not nobias ) : #NEWLINE# #INDENT# self . add_param ( 'b' , out_channels ) #NEWLINE# self . b . data = numpy . repeat ( numpy . float32 ( bias ) , out_channels ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . b = None