<s> from chainer . functions . activation import relu <EOL> from chainer import link <EOL> from chainer . links . connection import convolution_2d <EOL> class MLPConvolution2D ( link . ChainList ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , in_channels , out_channels , ksize , stride = <NUM_LIT:1> , pad = <NUM_LIT:0> , <EOL> wscale = <NUM_LIT:1> , activation = relu . relu , use_cudnn = True ) : <EOL> assert len ( out_channels ) > <NUM_LIT:0> <EOL> convs = [ convolution_2d . Convolution2D ( <EOL> in_channels , out_channels [ <NUM_LIT:0> ] , ksize , stride , pad , <EOL> wscale = wscale , use_cudnn = use_cudnn ) ] <EOL> for n_in , n_out in zip ( out_channels , out_channels [ <NUM_LIT:1> : ] ) : <EOL> convs . append ( convolution_2d . Convolution2D ( <EOL> n_in , n_out , <NUM_LIT:1> , wscale = wscale , use_cudnn = use_cudnn ) ) <EOL> super ( MLPConvolution2D , self ) . __init__ ( * convs ) <EOL> self . activation = activation <EOL> def __call__ ( self , x ) : <EOL> """<STR_LIT>""" <EOL> f = self . activation <EOL> for l in self [ : - <NUM_LIT:1> ] : <EOL> x = f ( l ( x ) ) <EOL> return self [ - <NUM_LIT:1> ] ( x ) </s>
