#NEWLINE# def _is_zero( x ) : #NEWLINE# #INDENT# "\n    Returns 'yes', 'no', or 'maybe' indicating whether x\n    is always 0.\n    'maybe' means that x is an expression that is complicated enough\n    that we can't tell that it simplifies to 0.\n    " #NEWLINE# if ( not hasattr ( x , 'type' ) ) : #NEWLINE# #INDENT# return np . all ( ( no_constant_value == 0.0 ) ) #NEWLINE# #UNINDENT# if isinstance ( x . type , NullType ) : #NEWLINE# #INDENT# return 'no' #NEWLINE# #UNINDENT# if isinstance ( x . type , DisconnectedType ) : #NEWLINE# #INDENT# return 'yes' #NEWLINE# #UNINDENT# no_constant_value = True #NEWLINE# try : #NEWLINE# #INDENT# constant_value = theano . get_scalar_constant_value ( x ) #NEWLINE# no_constant_value = False #NEWLINE# #UNINDENT# except theano . tensor . basic . NotScalarConstantError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# if no_constant_value : #NEWLINE# #INDENT# return 'maybe' #NEWLINE# #UNINDENT# if ( constant_value != 0.0 ) : #NEWLINE# #INDENT# return 'no' #NEWLINE# #UNINDENT# return 'yes'