<s> """<STR_LIT>""" <EOL> from neon . util . argparser import NeonArgparser <EOL> from neon . initializers import Constant , Gaussian <EOL> from neon . layers import Conv , Dropout , Pooling , GeneralizedCost , Affine <EOL> from neon . optimizers import GradientDescentMomentum , MultiOptimizer , Schedule <EOL> from neon . transforms import Rectlin , Softmax , CrossEntropyMulti , TopKMisclassification <EOL> from neon . models import Model <EOL> from neon . data import ImageLoader <EOL> from neon . callbacks . callbacks import Callbacks <EOL> parser = NeonArgparser ( __doc__ ) <EOL> args = parser . parse_args ( ) <EOL> img_set_options = dict ( repo_dir = args . data_dir , <EOL> inner_size = <NUM_LIT> , <EOL> subset_pct = <NUM_LIT> ) <EOL> train = ImageLoader ( set_name = '<STR_LIT:train>' , scale_range = ( <NUM_LIT> , <NUM_LIT> ) , shuffle = False , <EOL> do_transforms = False , ** img_set_options ) <EOL> test = ImageLoader ( set_name = '<STR_LIT>' , scale_range = ( <NUM_LIT> , <NUM_LIT> ) , shuffle = False , <EOL> do_transforms = False , ** img_set_options ) <EOL> layers = [ Conv ( ( <NUM_LIT:11> , <NUM_LIT:11> , <NUM_LIT:64> ) , init = Gaussian ( scale = <NUM_LIT> ) , bias = Constant ( <NUM_LIT:0> ) , <EOL> activation = Rectlin ( ) , padding = <NUM_LIT:3> , strides = <NUM_LIT:4> ) , <EOL> Pooling ( <NUM_LIT:3> , strides = <NUM_LIT:2> ) , <EOL> Conv ( ( <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT> ) , init = Gaussian ( scale = <NUM_LIT> ) , bias = Constant ( <NUM_LIT:1> ) , <EOL> activation = Rectlin ( ) , padding = <NUM_LIT:2> ) , <EOL> Pooling ( <NUM_LIT:3> , strides = <NUM_LIT:2> ) , <EOL> Conv ( ( <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT> ) , init = Gaussian ( scale = <NUM_LIT> ) , bias = Constant ( <NUM_LIT:0> ) , <EOL> activation = Rectlin ( ) , padding = <NUM_LIT:1> ) , <EOL> Conv ( ( <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT> ) , init = Gaussian ( scale = <NUM_LIT> ) , bias = Constant ( <NUM_LIT:1> ) , <EOL> activation = Rectlin ( ) , padding = <NUM_LIT:1> ) , <EOL> Conv ( ( <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT> ) , init = Gaussian ( scale = <NUM_LIT> ) , bias = Constant ( <NUM_LIT:1> ) , <EOL> activation = Rectlin ( ) , padding = <NUM_LIT:1> ) , <EOL> Pooling ( <NUM_LIT:3> , strides = <NUM_LIT:2> ) , <EOL> Affine ( nout = <NUM_LIT> , init = Gaussian ( scale = <NUM_LIT> ) , bias = Constant ( <NUM_LIT:1> ) , activation = Rectlin ( ) ) , <EOL> Dropout ( keep = <NUM_LIT:1.0> ) , <EOL> Affine ( nout = <NUM_LIT> , init = Gaussian ( scale = <NUM_LIT> ) , bias = Constant ( <NUM_LIT:1> ) , activation = Rectlin ( ) ) , <EOL> Dropout ( keep = <NUM_LIT:1.0> ) , <EOL> Affine ( nout = <NUM_LIT:1000> , init = Gaussian ( scale = <NUM_LIT> ) , bias = Constant ( - <NUM_LIT:7> ) , activation = Softmax ( ) ) ] <EOL> model = Model ( layers = layers ) <EOL> weight_sched = Schedule ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] , ( <NUM_LIT:1> / <NUM_LIT> ) ** ( <NUM_LIT:1> / <NUM_LIT> ) ) <EOL> opt_gdm = GradientDescentMomentum ( <NUM_LIT> / <NUM_LIT:10> , <NUM_LIT> , wdecay = <NUM_LIT> , schedule = weight_sched , <EOL> stochastic_round = args . rounding ) <EOL> opt_biases = GradientDescentMomentum ( <NUM_LIT> / <NUM_LIT:10> , <NUM_LIT> , schedule = Schedule ( [ <NUM_LIT> ] , <NUM_LIT:0.1> ) , <EOL> stochastic_round = args . rounding ) <EOL> opt = MultiOptimizer ( { '<STR_LIT:default>' : opt_gdm , '<STR_LIT>' : opt_biases } ) <EOL> valmetric = TopKMisclassification ( k = <NUM_LIT:5> ) <EOL> callbacks = Callbacks ( model , eval_set = test , metric = valmetric , ** args . callback_args ) <EOL> cost = GeneralizedCost ( costfunc = CrossEntropyMulti ( ) ) <EOL> model . fit ( train , optimizer = opt , num_epochs = args . epochs , cost = cost , callbacks = callbacks ) </s>
