提交 d906e876 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Include 'fast_run' optimizations to make test pass in FAST_COMPILE

上级 4f2a0f22
...@@ -287,7 +287,9 @@ def test_mlp(): ...@@ -287,7 +287,9 @@ def test_mlp():
gparam = T.grad(cost, param) gparam = T.grad(cost, param)
gparams.append(gparam) gparams.append(gparam)
# Some optimizations needed are tagged with 'fast_run'
# TODO: refine that and include only those
mode = theano.compile.get_default_mode().including('fast_run')
updates2 = {} updates2 = {}
...@@ -296,14 +298,15 @@ def test_mlp(): ...@@ -296,14 +298,15 @@ def test_mlp():
updates = updates2, updates = updates2,
givens={ givens={
x:train_set_x[index*batch_size:(index+1)*batch_size], x:train_set_x[index*batch_size:(index+1)*batch_size],
y:train_set_y[index*batch_size:(index+1)*batch_size]}) y:train_set_y[index*batch_size:(index+1)*batch_size]},
mode=mode)
for i in train_model.maker.env.toposort(): print i for i in train_model.maker.env.toposort(): print i
theano.printing.pydotprint(train_model) theano.printing.pydotprint(train_model)
assert any( [isinstance(i.op,T.nnet.CrossentropySoftmax1HotWithBiasDx) for i in train_model.maker.env.toposort()]) assert any( [isinstance(i.op,T.nnet.CrossentropySoftmax1HotWithBiasDx) for i in train_model.maker.env.toposort()])
train_model =theano.function( inputs = [index], train_model =theano.function( inputs = [index],
updates = updates2, updates = updates2,
mode=theano.compile.get_default_mode().excluding('local_track_shape_i'), mode=mode.excluding('local_track_shape_i'),
givens={ givens={
x:train_set_x[index*batch_size:(index+1)*batch_size], x:train_set_x[index*batch_size:(index+1)*batch_size],
y:train_set_y[index*batch_size:(index+1)*batch_size]}) y:train_set_y[index*batch_size:(index+1)*batch_size]})
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论