#NEWLINE# def main( params ) : #NEWLINE# #INDENT# ( ( Xtr , ytr_c , ytr_f ) , ( Xva , yva_c , yva_f ) , ( Xte , yte_c , yte_f ) , ( le_c , le_f ) ) = df . datasets . cifar100 . data ( ) #NEWLINE# model = cnn ( 32 , df . Parallel ( df . Sequential ( df . Linear ( 1024 , 20 , init = df . init . const ( 0 ) ) , df . SoftMax ( ) ) , df . Sequential ( df . Linear ( 1024 , 100 , init = df . init . const ( 0 ) ) , df . SoftMax ( ) ) ) ) #NEWLINE# crit = df . ParallelCriterion ( ( 0.75 , df . ClassNLLCriterion ( ) ) , df . ClassNLLCriterion ( ) ) #NEWLINE# crit . add_penalty ( 0.0001 , df . L1WeightDecay ( model ) ) #NEWLINE# crit . add_penalty ( 1e-05 , df . L2WeightDecay ( model ) ) #NEWLINE# optim = df . AdaDelta ( params [ 'adadelta_rho' ] ) #NEWLINE# for epoch in range ( 100 ) : #NEWLINE# #INDENT# model . training ( ) #NEWLINE# train ( Xtr , ytr_c , ytr_f , model , optim , crit , epoch , params [ 'batch_size' ] , 'train' ) #NEWLINE# train ( Xtr , ytr_c , ytr_f , model , optim , crit , epoch , params [ 'batch_size' ] , 'stats' ) #NEWLINE# model . evaluate ( ) #NEWLINE# validate ( yte_c , yva_c , yva_f , model , epoch , params [ 'batch_size' ] )