<s> """<STR_LIT>""" <EOL> import theano <EOL> import numpy as np <EOL> def detect_nan ( i , node , fn ) : <EOL> if str ( node . op ) . startswith ( "<STR_LIT>" ) : <EOL> return <EOL> for output in fn . outputs : <EOL> if ( not isinstance ( output [ <NUM_LIT:0> ] , np . random . RandomState ) and <EOL> np . isnan ( output [ <NUM_LIT:0> ] ) . any ( ) ) : <EOL> print '<STR_LIT>' <EOL> theano . printing . debugprint ( node ) <EOL> print '<STR_LIT>' % [ input [ <NUM_LIT:0> ] for input in fn . inputs ] <EOL> print '<STR_LIT>' % [ output [ <NUM_LIT:0> ] for output in fn . outputs ] <EOL> import pdb ; pdb . set_trace ( ) <EOL> DETECT_NAN_MODE = theano . compile . MonitorMode ( post_func = detect_nan ) </s>
