def is_1pexp(t, only_process_constants=True):
 if (t.owner and (t.owner.op == tensor.add)):
  (scalars, scalar_inputs, nonconsts) = opt.scalarconsts_rest(t.owner.inputs, only_process_constants=only_process_constants)
  if (len(nonconsts) == 1):
   maybe_exp = nonconsts[0]
   if (maybe_exp.owner and (maybe_exp.owner.op == tensor.exp)):
    if scalars:
     scal_sum = scalars[0]
     for s in scalars[1:]:
      scal_sum = (scal_sum + s)
     if numpy.allclose(scal_sum, 1):
      return (False, maybe_exp.owner.inputs[0])
    if config.warn.identify_1pexp_bug:
     warnings.warn("Although your current code is fine, please note that Theano versions prior to 0.5 (more specifically, prior to commit 7987b51 on 2011-12-18) may have yielded an incorrect result. To remove this warning, either set the `warn.identify_1pexp_bug` config option to False, or `warn.ignore_bug_before` to at least '0.4.1'.")
 return None

def is_1pexp ( t , only_process_constants = True ) : if ( t . owner and ( t . owner . op == tensor . add ) ) : ( scalars , scalar_inputs , nonconsts ) = opt . scalarconsts_rest ( t . owner . inputs , only_process_constants = only_process_constants ) if ( len ( nonconsts ) == 1 ) : maybe_exp = nonconsts [ 0 ] if ( maybe_exp . owner and ( maybe_exp . owner . op == tensor . exp ) ) : if scalars : scal_sum = scalars [ 0 ] for s in scalars [ 1 : ] : scal_sum = ( scal_sum + s ) if numpy . allclose ( scal_sum , 1 ) : return ( False , maybe_exp . owner . inputs [ 0 ] ) if config . warn . identify_1pexp_bug : warnings . warn ( "Although your current code is fine, please note that Theano versions prior to 0.5 (more specifically, prior to commit 7987b51 on 2011-12-18) may have yielded an incorrect result. To remove this warning, either set the `warn.identify_1pexp_bug` config option to False, or `warn.ignore_bug_before` to at least '0.4.1'." ) return None
returns object if t is of the form (1+exp(x)) .