<s> import math <EOL> import chainer <EOL> import chainer . functions as F <EOL> import chainer . links as L <EOL> class NIN ( chainer . Chain ) : <EOL> """<STR_LIT>""" <EOL> insize = <NUM_LIT> <EOL> def __init__ ( self ) : <EOL> w = math . sqrt ( <NUM_LIT:2> ) <EOL> super ( NIN , self ) . __init__ ( <EOL> mlpconv1 = L . MLPConvolution2D ( <EOL> <NUM_LIT:3> , ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , <NUM_LIT:11> , stride = <NUM_LIT:4> , wscale = w ) , <EOL> mlpconv2 = L . MLPConvolution2D ( <EOL> <NUM_LIT> , ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , <NUM_LIT:5> , pad = <NUM_LIT:2> , wscale = w ) , <EOL> mlpconv3 = L . MLPConvolution2D ( <EOL> <NUM_LIT> , ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , <NUM_LIT:3> , pad = <NUM_LIT:1> , wscale = w ) , <EOL> mlpconv4 = L . MLPConvolution2D ( <EOL> <NUM_LIT> , ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1000> ) , <NUM_LIT:3> , pad = <NUM_LIT:1> , wscale = w ) , <EOL> ) <EOL> self . train = True <EOL> def __call__ ( self , x , t ) : <EOL> h = F . max_pooling_2d ( F . relu ( self . mlpconv1 ( x ) ) , <NUM_LIT:3> , stride = <NUM_LIT:2> ) <EOL> h = F . max_pooling_2d ( F . relu ( self . mlpconv2 ( h ) ) , <NUM_LIT:3> , stride = <NUM_LIT:2> ) <EOL> h = F . max_pooling_2d ( F . relu ( self . mlpconv3 ( h ) ) , <NUM_LIT:3> , stride = <NUM_LIT:2> ) <EOL> h = self . mlpconv4 ( F . dropout ( h , train = self . train ) ) <EOL> h = F . reshape ( F . average_pooling_2d ( h , <NUM_LIT:6> ) , ( x . data . shape [ <NUM_LIT:0> ] , <NUM_LIT:1000> ) ) <EOL> self . loss = F . softmax_cross_entropy ( h , t ) <EOL> self . accuracy = F . accuracy ( h , t ) <EOL> return self . loss <EOL> def predict ( self , x ) : <EOL> h = F . max_pooling_2d ( F . relu ( self . mlpconv1 ( x ) ) , <NUM_LIT:3> , stride = <NUM_LIT:2> ) <EOL> h = F . max_pooling_2d ( F . relu ( self . mlpconv2 ( h ) ) , <NUM_LIT:3> , stride = <NUM_LIT:2> ) <EOL> h = F . max_pooling_2d ( F . relu ( self . mlpconv3 ( h ) ) , <NUM_LIT:3> , stride = <NUM_LIT:2> ) <EOL> h = self . mlpconv4 ( F . dropout ( h , train = self . train ) ) <EOL> h = F . reshape ( F . average_pooling_2d ( h , <NUM_LIT:6> ) , ( x . data . shape [ <NUM_LIT:0> ] , <NUM_LIT:1000> ) ) <EOL> return F . softmax ( h ) </s>
