def setup_mainloop(extension, iteration_scheme=None):
 features = [numpy.array(f, dtype=theano.config.floatX) for f in ([[1, 2]] * 101)]
 dataset = IterableDataset(dict(features=features))
 data_stream = DataStream(dataset, iteration_scheme=iteration_scheme)
 W = shared_floatx([0, 0], name='W')
 x = tensor.vector('features')
 cost = tensor.sum(((x - W) ** 2))
 cost.name = 'cost'
 algorithm = GradientDescent(cost=cost, parameters=[W], step_rule=Scale(0.001))
 main_loop = MainLoop(model=None, data_stream=data_stream, algorithm=algorithm, extensions=[FinishAfter(after_n_epochs=1), extension])
 return main_loop

def setup_mainloop ( extension , iteration_scheme = None ) : features = [ numpy . array ( f , dtype = theano . config . floatX ) for f in ( [ [ 1 , 2 ] ] * 101 ) ] dataset = IterableDataset ( dict ( features = features ) ) data_stream = DataStream ( dataset , iteration_scheme = iteration_scheme ) W = shared_floatx ( [ 0 , 0 ] , name = 'W' ) x = tensor . vector ( 'features' ) cost = tensor . sum ( ( ( x - W ) ** 2 ) ) cost . name = 'cost' algorithm = GradientDescent ( cost = cost , parameters = [ W ] , step_rule = Scale ( 0.001 ) ) main_loop = MainLoop ( model = None , data_stream = data_stream , algorithm = algorithm , extensions = [ FinishAfter ( after_n_epochs = 1 ) , extension ] ) return main_loop
set up a simple main loop for progress bar tests .