<s> import theano <EOL> from theano . compile . mode import Mode , AddFeatureOptimizer <EOL> from theano . gof . toolbox import NoOutputFromInplace <EOL> import theano . tensor as T <EOL> def test_no_output_from_implace ( ) : <EOL> x = T . matrix ( ) <EOL> y = T . matrix ( ) <EOL> a = T . dot ( x , y ) <EOL> b = T . tanh ( a ) <EOL> fct_no_opt = theano . function ( [ x , y ] , b , mode = "<STR_LIT>" ) <EOL> op = fct_no_opt . maker . fgraph . outputs [ <NUM_LIT:0> ] . owner . op <EOL> assert ( hasattr ( op , '<STR_LIT>' ) and <NUM_LIT:0> in op . destroy_map ) <EOL> opt = AddFeatureOptimizer ( NoOutputFromInplace ( ) ) <EOL> mode_opt = Mode ( linker = "<STR_LIT>" , optimizer = "<STR_LIT>" ) . register ( ( opt , <NUM_LIT> ) ) <EOL> fct_opt = theano . function ( [ x , y ] , b , mode = mode_opt ) <EOL> op = fct_opt . maker . fgraph . outputs [ <NUM_LIT:0> ] . owner . op <EOL> assert ( not hasattr ( op , '<STR_LIT>' ) or <NUM_LIT:0> not in op . destroy_map ) <EOL> def test_including ( ) : <EOL> mode = theano . Mode ( optimizer = '<STR_LIT>' ) <EOL> mode . including ( '<STR_LIT>' ) </s>
