Module Expr Str ImportFrom alias alias alias Import alias Import alias Import alias ImportFrom alias alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias identifier ImportFrom alias alias alias ImportFrom alias ImportFrom alias ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam defaults body If CompareLt NameLoad Num body Return Num If CompareGt NameLoad Num body Return Num Assign NameStore Call NameLoad Call NameLoad NameLoad Str Str If CompareIn NameLoad TupleLoad Str Str body Return BinOpDiv Num BinOpAdd Num Call AttributeLoad NameLoad attr UnaryOpUSub NameLoad keyword Str Return BinOpDiv Num BinOpAdd Num Call AttributeLoad NameLoad attr UnaryOpUSub NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign TupleStore NameStore NameLoad Assign TupleStore NameStore NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore BinOpMult BinOpMult NameLoad NameLoad BinOpSub Num NameLoad Assert CompareNotEq Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Str Num Return ListLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Assign TupleStore NameStore NameLoad Assign TupleStore NameStore NameLoad If BoolOpOr CompareEq AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr AttributeLoad NameLoad attr CompareEq AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr AttributeLoad NameLoad attr body Return BinOpMod Str Call NameLoad orelse If CompareEq AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr AttributeLoad NameLoad attr body Return BinOpMod Str Call NameLoad orelse Raise Call NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad Call NameLoad NameLoad NameLoad attr If NameLoad body Return BinOpAdd TupleLoad Num NameLoad orelse Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Assign TupleStore NameStore NameLoad Assign TupleStore NameStore NameLoad If BoolOpOr UnaryOpNot AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr CompareNotEq AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr body Raise Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr If BoolOpAnd CompareEq NameLoad Str CompareIsNot AttributeLoad NameLoad attr NameLoad body Assign NameStore Str Assign NameStore Str orelse If BoolOpAnd CompareEq NameLoad Str CompareIsNot AttributeLoad NameLoad attr NameLoad body Assign NameStore Str Assign NameStore Str orelse Raise Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Return BinOpMod Str Call NameLoad Raise Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Assign NameStore BinOpDiv Num BinOpAdd Num Call AttributeLoad NameLoad attr UnaryOpUSub NameLoad FunctionDef arguments args NameParam defaults body Return Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad decorator_list Assign NameStore Call AttributeLoad Call NameLoad NameLoad attr Assign NameStore Call AttributeLoad Call NameLoad NameLoad attr Import alias identifier Import alias Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str Str Str Str Str Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad Str NameLoad Expr Call NameLoad Call AttributeLoad NameLoad attr Expr Call NameLoad Call AttributeLoad NameLoad attr decorator_list NameLoad decorator_list Assign NameStore Call NameLoad AttributeLoad NameLoad attr keyword Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr Num keyword Dict Num Num keyword Str Expr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr Str ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam defaults body Assign NameStore BinOpMult Num NameLoad If CompareGtE NameLoad Num body If CompareLt NameLoad Num body Assign NameStore BinOpDiv BinOpMult Num NameLoad BinOpAdd Num NameLoad orelse If CompareLt NameLoad Num body Assign NameStore BinOpAdd Num BinOpMult Num BinOpSub NameLoad Num orelse Assign NameStore Num orelse Assign NameStore UnaryOpUSub NameLoad If CompareLt NameLoad Num body Assign NameStore BinOpDiv BinOpMult Num NameLoad BinOpAdd Num NameLoad orelse If CompareLt NameLoad Num body Assign NameStore BinOpAdd Num BinOpMult Num BinOpSub NameLoad Num orelse Assign NameStore Num Assign NameStore UnaryOpUSub NameLoad Return BinOpMult Num BinOpAdd NameLoad Num decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Assign TupleStore NameStore NameLoad Assign TupleStore NameStore NameLoad Assign NameStore SubscriptLoad Call AttributeLoad AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr attr Index Num Return BinOpMod Str Call NameLoad decorator_list decorator_list Assign NameStore Call NameLoad AttributeLoad NameLoad attr keyword Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr Num keyword Dict Num Num keyword Str Expr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Expr Str If BoolOpAnd Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareEq AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Expr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad keyword Num decorator_list Assign AttributeStore AttributeLoad NameLoad attr attr NameLoad Return ListLoad NameLoad decorator_list Call AttributeLoad NameLoad attr ListLoad NameLoad Expr Call AttributeLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Str attr Str NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore AttributeLoad SubscriptLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Index Num attr Assign NameStore Call AttributeLoad NameLoad attr Num keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num keyword NameLoad Assign NameStore BinOpAdd BinOpMult NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Num Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body If BoolOpAnd Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareEq AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Expr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad keyword Num decorator_list Assign AttributeStore AttributeLoad NameLoad attr attr NameLoad Return ListLoad NameLoad decorator_list Call AttributeLoad NameLoad attr ListLoad NameLoad Expr Call AttributeLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Str attr Str NameLoad ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam defaults body If CompareLt NameLoad Num body Return Num If CompareGt NameLoad Num body Return NameLoad Assign NameStore Call NameLoad Call NameLoad NameLoad Str Str If CompareIn NameLoad TupleLoad Str Str body Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad keyword Str Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign TupleStore NameStore NameLoad Assign TupleStore NameStore NameLoad Return ListLoad BinOpMult NameLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Assign TupleStore NameStore NameLoad Assign TupleStore NameStore NameLoad If BoolOpOr CompareEq AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr AttributeLoad NameLoad attr CompareEq AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr AttributeLoad NameLoad attr body Return BinOpMod Str Call NameLoad orelse If CompareEq AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr AttributeLoad NameLoad attr body Return BinOpMod Str Call NameLoad orelse Raise Call NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad Call NameLoad NameLoad NameLoad attr If NameLoad body Return BinOpAdd TupleLoad Num NameLoad orelse Return NameLoad decorator_list decorator_list Assign NameStore Call NameLoad AttributeLoad NameLoad attr keyword Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str Expr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body If BoolOpAnd AttributeLoad NameLoad attr CompareEq AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Assign NameStore ListComp NameLoad comprehension NameStore AttributeLoad AttributeLoad NameLoad attr attr UnaryOpNot Call NameLoad NameLoad If CompareEq Call NameLoad NameLoad Num body Return SubscriptLoad NameLoad Index Num decorator_list Assign NameStore Call AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr TupleLoad NameLoad Str TupleLoad AttributeLoad NameLoad attr TupleLoad NameLoad TupleLoad AttributeLoad NameLoad attr Str keyword NameLoad keyword NameLoad keyword NameLoad FunctionDef arguments args NameParam defaults body Expr Str TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr NameLoad Num handlers ExceptHandler type AttributeLoad NameLoad attr body Return NameLoad decorator_list Assign NameStore Call AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr Call NameLoad keyword Str keyword NameLoad TupleLoad NameLoad Str TupleLoad AttributeLoad NameLoad attr TupleLoad NameLoad Str keyword NameLoad keyword NameLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr Str TupleLoad NameLoad Str keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad keyword Str Expr Call AttributeLoad NameLoad attr NameLoad keyword Str Expr Call AttributeLoad NameLoad attr NameLoad keyword Str FunctionDef arguments args NameParam defaults body Expr Str If BoolOpAnd AttributeLoad NameLoad attr CompareEq AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr If CompareEq Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad NameLoad Index Num If BoolOpAnd AttributeLoad NameLoad attr CompareEq AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body If NameLoad body Assign NameStore SubscriptLoad NameLoad Index Num For NameStore SubscriptLoad NameLoad Slice Num body Assign NameStore BinOpAdd NameLoad NameLoad If Call AttributeLoad NameLoad attr NameLoad Num body Return TupleLoad NameLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num If AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad NameLoad attr Str Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore NameLoad Assign NameStore Call NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Assign NameStore NameLoad Assign NameStore NameLoad If BoolOpAnd AttributeLoad NameLoad attr CompareEq AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Return TupleLoad NameLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str If BoolOpAnd AttributeLoad NameLoad attr CompareEq AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Return AttributeLoad AttributeLoad NameLoad attr attr orelse Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If BoolOpAnd AttributeLoad NameLoad attr CompareEq AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr orelse Assign NameStore ListLoad NameLoad Assign NameStore ListLoad Assign NameStore NameLoad Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore Call NameLoad NameLoad If CompareIs NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad orelse Assign TupleStore NameStore NameStore NameLoad Expr Call AttributeLoad NameLoad attr NameLoad AugAssignBitXor NameStore NameLoad Return TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr If UnaryOpNot NameLoad body Return NameLoad If CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return SubscriptLoad AttributeLoad NameLoad attr Index Num If BoolOpAnd CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareGtE Call NameLoad AttributeLoad NameLoad attr Num body For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr body TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num handlers ExceptHandler type NameLoad body Assign NameStore NameLoad If NameLoad body If CompareEq Call NameLoad AttributeLoad NameLoad attr Num body Return SubscriptLoad AttributeLoad NameLoad attr Index BinOpSub Num NameLoad orelse Return Call AttributeLoad NameLoad attr BinOpAdd SubscriptLoad AttributeLoad NameLoad attr Slice Num NameLoad SubscriptLoad AttributeLoad NameLoad attr Slice BinOpAdd NameLoad Num Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad Assign NameStore ListLoad For NameStore NameLoad body If CompareIn NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Delete SubscriptDel NameLoad Index Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr Call NameLoad UnaryOpUSub NameLoad If UnaryOpNot NameLoad body Return Assign NameStore BinOpAdd BinOpAdd NameLoad ListComp Call AttributeLoad NameLoad attr NameLoad comprehension NameStore NameLoad NameLoad If CompareEq Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad NameLoad Index Num orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad If BinOpBitXor NameLoad NameLoad body Assign NameStore UnaryOpUSub NameLoad If CompareEq Call NameLoad NameLoad Num body Return ListLoad NameLoad orelse If CompareEq Call NameLoad NameLoad Num body Return ListLoad BinOpDiv NameLoad SubscriptLoad NameLoad Index Num orelse Return ListLoad BinOpDiv NameLoad Call AttributeLoad NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr ListLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad If CompareIs NameLoad NameLoad body Return ListLoad NameLoad NameLoad orelse Assign TupleStore NameStore NameStore Call NameLoad NameLoad Return ListLoad UnaryOpNot NameLoad NameLoad orelse Return ListLoad NameLoad Call NameLoad Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareEq SubscriptLoad NameLoad Index Num NameLoad body AugAssignBitXor SubscriptStore SubscriptLoad NameLoad Index Num Index Num NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index Num Index Num Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore ListLoad For NameStore Call NameLoad NameLoad NameLoad body If CompareIs SubscriptLoad NameLoad Index Num NameLoad body AugAssignBitXor NameStore SubscriptLoad NameLoad Index Num orelse Expr Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot NameLoad body Assign NameStore ListLoad NameLoad NameLoad orelse If CompareEq Call NameLoad NameLoad Num body AugAssignBitXor SubscriptStore SubscriptLoad NameLoad Index Num Index Num NameLoad Assign NameStore SubscriptLoad NameLoad Index Num orelse Assign NameStore ListLoad NameLoad NameLoad orelse Assign NameStore NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameLoad If CompareIs NameLoad NameLoad body Raise Call NameLoad Str orelse If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad Call NameLoad NameLoad NameLoad orelse Assign NameStore NameLoad If NameLoad body Assign NameStore UnaryOpUSub NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore ListLoad If CompareIs NameLoad NameLoad body Assign NameStore ListLoad If CompareIs NameLoad NameLoad body Assign NameStore ListLoad If CompareIs NameLoad NameLoad body Assign NameStore ListLoad If CompareIs NameLoad NameLoad body Assign NameStore NameLoad If NameLoad body Expr Call NameLoad Str Expr Call NameLoad BinOpMod Str NameLoad Expr Call NameLoad BinOpMod Str NameLoad Expr Call NameLoad BinOpMod Str NameLoad Expr Call NameLoad BinOpMod Str NameLoad Expr Call NameLoad BinOpMod Str NameLoad Expr Call NameLoad BinOpMod Str NameLoad Assign TupleStore NameStore NameStore NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body AugAssignBitOr NameStore Call NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Return NameLoad orelse Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore Call NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Assign TupleStore NameStore NameStore NameLoad AugAssignBitXor NameStore NameLoad Assign NameStore Call NameLoad NameLoad If CompareIs NameLoad NameLoad body If UnaryOpNot Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore NameLoad orelse If UnaryOpNot Call NameLoad NameLoad NameLoad NameLoad Lambda arguments args NameParam defaults Call NameLoad UnaryOpUSub NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore NameLoad orelse If BoolOpAnd AttributeLoad NameLoad attr CompareEq AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Assign NameStore Call NameLoad NameLoad If CompareIs NameLoad NameLoad body If UnaryOpNot Call NameLoad NameLoad NameLoad NameLoad Lambda arguments args NameParam defaults Call NameLoad UnaryOpUSub NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore NameLoad orelse If UnaryOpNot Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore NameLoad orelse Assign NameStore NameLoad If UnaryOpNot NameLoad body Assert CompareIsNot NameLoad NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index Num Index NameLoad ListLoad NameLoad NameLoad Return UnaryOpNot NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareNotEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return NameLoad Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Call NameLoad NameLoad If UnaryOpNot NameLoad body Return NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Expr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad Return ListLoad NameLoad decorator_list AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr ListLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str If CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num If BoolOpAnd AttributeLoad NameLoad attr CompareEq AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr If CompareEq Call NameLoad NameLoad Num body If BoolOpAnd AttributeLoad SubscriptLoad NameLoad Index Num attr CompareEq AttributeLoad AttributeLoad SubscriptLoad NameLoad Index Num attr attr AttributeLoad NameLoad attr body If BoolOpAnd NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Num body Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad AttributeLoad SubscriptLoad NameLoad Index Num attr attr Index Num NameLoad Expr Call NameLoad ListLoad SubscriptLoad NameLoad Index Num NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad Return NameLoad decorator_list AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr ListLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str If CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr If CompareGt Call NameLoad AttributeLoad NameLoad attr Num body Return If BoolOpAnd AttributeLoad NameLoad attr CompareEq AttributeLoad AttributeLoad NameLoad attr attr NameLoad body TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Return If Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Num body Assign NameStore Call NameLoad UnaryOpUSub SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Expr Call NameLoad ListLoad NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad Return ListLoad NameLoad decorator_list Call AttributeLoad NameLoad attr ListLoad AttributeLoad NameLoad attr Assign NameStore NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If Num body FunctionDef arguments args NameParam defaults body Expr Call NameLoad Str Expr Call NameLoad Call NameLoad NameLoad decorator_list AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr ListLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr If CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore ListLoad For NameStore AttributeLoad NameLoad attr body AugAssignAdd NameStore Call NameLoad NameLoad Return NameLoad If CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num For NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num body Assign NameStore NameLoad Assign NameStore ListLoad For NameStore Call NameLoad NameLoad body For NameStore NameLoad body Assert CompareEq AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assert CompareEq AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign TupleStore NameStore NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign TupleStore NameStore NameStore AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Call NameLoad Call NameLoad BinOpAdd NameLoad NameLoad Call NameLoad BinOpAdd NameLoad NameLoad If CompareGt Call NameLoad NameLoad Num body Return ListLoad orelse If CompareGt Call NameLoad AttributeLoad NameLoad attr Num body Return ListLoad orelse Return ListLoad SubscriptLoad AttributeLoad NameLoad attr Index Num decorator_list
N/A N/A 
Ops and optimizations: sigmoid, softplus.

These functions implement special cases of exp and log to improve numerical
stability.

 __future__ absolute_import print_function division N/A warnings N/A numpy N/A theano theano config gof printing scalar theano.compat imap theano.printing pprint theano.tensor basic tensor theano.tensor elemwise opt NotScalarConstantError theano.tensor.type values_eq_approx_remove_inf theano.gof.opt copy_stack_trace ScalarSigmoid N/A N/A scalar UnaryScalarOp N/A N/A 
    This is just speed opt. Not for stability.

     st_impl N/A N/A x N/A N/A N/A N/A x -30.0 N/A N/A 0.0 N/A N/A x 30.0 N/A N/A 1.0 N/A x_dtype N/A str N/A getattr x dtype N/A N/A x_dtype N/A int8 uint8 N/A N/A N/A 1.0 N/A 1.0 N/A N/A numpy exp N/A x sig f N/A N/A 1.0 N/A 1.0 N/A N/A numpy exp N/A x N/A staticmethod impl N/A N/A self x N/A N/A N/A N/A N/A ScalarSigmoid st_impl x N/A grad N/A N/A self inp grads N/A N/A N/A N/A x inp N/A N/A gz grads N/A y N/A scalar_sigmoid x N/A rval N/A N/A gz y N/A 1.0 y N/A N/A N/A N/A N/A N/A rval type dtype find float -1 N/A N/A rval N/A c_code N/A N/A self node name inp out sub N/A N/A N/A N/A x inp N/A N/A z out N/A N/A N/A N/A N/A N/A node inputs N/A 0 type N/A scalar float32 N/A N/A N/A N/A node inputs N/A 0 type N/A scalar float16 N/A N/A N/A %(z)s = %(x)s < -88.0f ? 0.0 : %(x)s > 15.0f ? 1.0f : 1.0f /(1.0f + exp(-%(x)s)); N/A locals N/A N/A N/A N/A N/A N/A node inputs N/A 0 type N/A scalar float64 N/A N/A N/A %(z)s = %(x)s < -709.0 ? 0.0 : %(x)s > 19.0 ? 1.0 : 1.0 /(1.0+exp(-%(x)s)); N/A locals N/A N/A N/A NotImplementedError only floatingpoint is implemented N/A c_code_cache_version N/A N/A self N/A N/A N/A v N/A N/A N/A super ScalarSigmoid self c_code_cache_version N/A v N/A N/A N/A N/A 2 v N/A N/A v N/A c_code_contiguous_disabled N/A N/A self node name inp out sub N/A N/A N/A N/A x inp N/A N/A z out N/A N/A N/A N/A N/A N/A theano config lib amdlibm N/A N/A N/A N/A node inputs N/A 0 dtype N/A N/A N/A node outputs N/A 0 dtype N/A N/A N/A N/A N/A N/A theano gof utils MethodNotDefined N/A dtype N/A N/A N/A node inputs N/A 0 dtype N/A N/A N/A dtype float32 N/A N/A self amd_float32 None N/A N/A dtype float N/A fct amd_vrsa_expf N/A N/A N/A N/A dtype float64 N/A N/A self amd_float64 None N/A N/A dtype double N/A fct amd_vrda_exp N/A N/A N/A N/A N/A N/A theano gof utils MethodNotDefined N/A N/A 
        npy_intp n = PyArray_SIZE(%(z)s);
        %(dtype)s * x = (%(dtype)s*) PyArray_DATA(%(x)s);
        %(dtype)s * z = (%(dtype)s*) PyArray_DATA(%(z)s);
        // We block to keep the data in l1
        // normal l1 size = 32k: 32k/2(input + output)/8(nb bytes of double)=2k
        // We stay bellow the 2k limit to let space for
        // This is faster than the not blocking version
        for(int i=0;i<n;i+=2048){
            npy_intp nb = (n-i<2048)?n-i:2048;
            for(int j=0;j<nb;j++){
                z[i+j] = -x[i+j];
            }
            %(fct)s(nb, z+i, z+i);
            for(int j=0;j<nb;j++){
                z[i+j] = 1.0 /(1.0+z[i+j]);
            }
        }
         N/A locals N/A N/A N/A N/A N/A theano gof utils MethodNotDefined N/A gen_graph N/A N/A N/A N/A N/A 
        This method was used to generate the graph: sigmoid_prec.png in the doc.

         N/A data N/A N/A numpy arange -15 15 0.1 N/A val N/A 1 N/A 1 N/A N/A numpy exp N/A data hard_sigmoid N/A N/A x N/A N/A N/A N/A N/A N/A N/A theano tensor nnet hard_sigmoid x N/A ultra_fast_sigmoid N/A N/A x N/A N/A N/A N/A N/A N/A N/A theano tensor nnet ultra_fast_sigmoid x N/A N/A val_hard N/A N/A N/A hard_sigmoid data eval N/A val_ultra N/A N/A N/A ultra_fast_sigmoid data eval N/A matplotlib.pyplot plt N/A os N/A fig N/A N/A plt figure N/A ax N/A N/A fig add_subplot 111 N/A N/A N/A ax plot data val N/A N/A N/A ax plot data val_ultra N/A N/A N/A ax plot data val_hard N/A N/A N/A ax grid True N/A N/A N/A ax legend N/A sigmoid ultra_fast hard upper left N/A fname N/A N/A N/A os path join N/A N/A N/A os path dirname N/A theano __file__ .. doc library tensor nnet sigmoid_prec.png N/A N/A N/A plt savefig fname N/A N/A print New picture saved at fname N/A N/A print N/A N/A val_ultra max N/A N/A print N/A N/A val_ultra min N/A staticmethod N/A N/A scalar_sigmoid N/A ScalarSigmoid N/A scalar upgrade_to_float name scalar_sigmoid N/A sigmoid N/A N/A elemwise Elemwise scalar_sigmoid name sigmoid N/A sigmoid_inplace N/A N/A elemwise Elemwise N/A ScalarSigmoid N/A N/A scalar transfer_type 0 inplace_pattern N/A 0 0 name sigmoid_inplace N/A N/A N/A pprint assign sigmoid N/A N/A printing FunctionPrinter sigmoid UltraFastScalarSigmoid N/A N/A scalar UnaryScalarOp N/A N/A 
    This is just speed opt. Not for stability.

     st_impl N/A N/A x N/A N/A N/A x N/A 0.5 x N/A N/A x 0 N/A N/A N/A x 1.7 N/A N/A z N/A N/A 1.5 x N/A 1 x N/A N/A N/A x 3 N/A N/A z N/A 0.935409070603 N/A 0.0458812946797 N/A x 1.7 N/A N/A z 0.995054753687 N/A N/A xx N/A x N/A N/A xx 1.7 N/A N/A z N/A N/A 1.5 xx N/A 1 xx N/A N/A N/A xx 3 N/A N/A z N/A 0.935409070603 N/A 0.0458812946797 N/A xx 1.7 N/A N/A z 0.995054753687 N/A z N/A z N/A N/A 0.5 N/A z 1.0 N/A staticmethod impl N/A N/A self x N/A N/A N/A N/A N/A UltraFastScalarSigmoid st_impl x N/A c_code N/A N/A self node name inp out sub N/A N/A N/A N/A x inp N/A N/A z out N/A dtype N/A N/A N/A N/A N/A N/A node outputs N/A 0 type dtype_specs N/A 1 N/A N/A 
        %(dtype)s x = 0.5 * %(x)s;
   // The if is a tanh approximate.
   if(x>=0) {
        %(z)s = (x<1.7 ? (1.5*x/(1+x)) :
                         (x<3 ? (0.935409070603099 + 0.0458812946797165*(x-1.7)):
                         0.99505475368673));
    } else {
        %(dtype)s xx = -x;
        %(z)s = -(xx<1.7 ? (1.5*xx/(1+xx)) :
                           (xx<3 ? (0.935409070603099 + 0.0458812946797165*(xx-1.7)):
                                   0.99505475368673));
    }

        //%(z)s = 0.5*(ultrafasttanh(0.5*x)+1.);
        %(z)s = 0.5*(%(z)s+1.);
         N/A locals N/A N/A N/A ultra_fast_scalar_sigmoid N/A UltraFastScalarSigmoid N/A scalar upgrade_to_float name ultra_fast_scalar_sigmoid N/A ultra_fast_sigmoid N/A N/A elemwise Elemwise ultra_fast_scalar_sigmoid name ultra_fast_sigmoid N/A ultra_fast_sigmoid_inplace N/A N/A elemwise Elemwise N/A UltraFastScalarSigmoid N/A N/A scalar transfer_type 0 inplace_pattern N/A 0 0 name ultra_fast_sigmoid_inplace N/A N/A N/A pprint assign ultra_fast_sigmoid N/A N/A printing FunctionPrinter ultra_fast_sigmoid local_ultra_fast_sigmoid N/A N/A node N/A N/A N/A 
    When enabled, change all sigmoid to ultra_fast_sigmoid.

    For example do mode.including('local_ultra_fast_sigmoid')
    or use the Theano flag optimizer_including=local_ultra_fast_sigmoid.

    This speeds up the sigmoid op by using an approximation.

    This is done after the stabilization and specialize phases
    to avoid interacting with them.

     N/A N/A N/A isinstance N/A node op N/A tensor Elemwise N/A N/A N/A node op scalar_op scalar_sigmoid N/A N/A out N/A ultra_fast_sigmoid N/A N/A node inputs N/A 0 N/A N/A copy_stack_trace N/A N/A node outputs N/A 0 out values_eq_approx_remove_low_prec N/A N/A a b N/A N/A N/A N/A N/A N/A tensor TensorType values_eq_approx a b atol 0.02 N/A N/A N/A N/A out tag values_eq_approx values_eq_approx_remove_low_prec N/A N/A out N/A N/A N/A gof local_optimizer N/A sigmoid N/A N/A N/A N/A N/A N/A theano compile optdb N/A uncanonicalize register local_ultra_fast_sigmoid local_ultra_fast_sigmoid hard_sigmoid N/A N/A x N/A N/A N/A 
    An approximation of sigmoid.

    More approximate and faster than ultra_fast_sigmoid.

    Approx in 3 parts: 0, scaled linear, 1.

    Removing the slope and shift does not make it faster.

     N/A out_dtype N/A N/A N/A N/A scalar upgrade_to_float N/A N/A scalar Scalar dtype N/A x dtype N/A 0 dtype N/A slope N/A N/A tensor constant 0.2 dtype out_dtype N/A shift N/A N/A tensor constant 0.5 dtype out_dtype N/A x N/A N/A x slope shift N/A x N/A N/A tensor clip x 0 1 N/A x N/A local_hard_sigmoid N/A N/A node N/A N/A N/A N/A N/A isinstance N/A node op N/A tensor Elemwise N/A N/A N/A node op scalar_op scalar_sigmoid N/A N/A out N/A hard_sigmoid N/A N/A node inputs N/A 0 N/A N/A copy_stack_trace N/A N/A node outputs N/A 0 out values_eq_approx_remove_low_prec N/A N/A a b N/A N/A N/A N/A N/A N/A tensor TensorType values_eq_approx a b atol 0.1 N/A N/A N/A N/A out tag values_eq_approx values_eq_approx_remove_low_prec N/A N/A out N/A N/A N/A gof local_optimizer N/A sigmoid N/A N/A N/A N/A N/A N/A theano compile optdb N/A uncanonicalize register local_hard_sigmoid local_hard_sigmoid ScalarSoftplus N/A N/A scalar UnaryScalarOp N/A N/A 
    This helps numerical stability.
     static_impl N/A N/A x N/A N/A N/A N/A x -30.0 N/A N/A 0.0 N/A N/A x 30.0 N/A N/A x N/A x_dtype N/A str N/A getattr x dtype N/A N/A x_dtype N/A int8 uint8 N/A N/A N/A N/A numpy log1p N/A N/A numpy exp x sig f N/A N/A N/A numpy log1p N/A N/A numpy exp x N/A staticmethod impl N/A N/A self x N/A N/A N/A N/A N/A ScalarSoftplus static_impl x N/A grad N/A N/A self inp grads N/A N/A N/A N/A x inp N/A N/A gz grads N/A N/A N/A gz N/A scalar_sigmoid x N/A c_code N/A N/A self node name inp out sub N/A N/A N/A N/A x inp N/A N/A z out N/A N/A N/A N/A N/A N/A node inputs N/A 0 type N/A scalar float32 N/A N/A N/A N/A node inputs N/A 0 type N/A scalar float16 N/A N/A N/A %(z)s = %(x)s < -103.0f ? 0.0 : %(x)s > 14.0f ? %(x)s : log1p(exp(%(x)s)); N/A locals N/A N/A N/A N/A N/A N/A node inputs N/A 0 type N/A scalar float64 N/A N/A N/A %(z)s = %(x)s < -745.0 ? 0.0 : %(x)s > 16.0 ? %(x)s : log1p(exp(%(x)s)); N/A locals N/A N/A N/A NotImplementedError only floatingpoint is implemented N/A c_code_cache_version N/A N/A self N/A N/A N/A v N/A N/A N/A super ScalarSoftplus self c_code_cache_version N/A v N/A N/A N/A N/A 2 v N/A N/A v N/A N/A N/A scalar_softplus N/A ScalarSoftplus N/A scalar upgrade_to_float name scalar_softplus N/A softplus N/A N/A elemwise Elemwise scalar_softplus name softplus N/A N/A N/A pprint assign softplus N/A N/A printing FunctionPrinter softplus _skip_mul_1 N/A N/A r N/A N/A N/A N/A N/A r owner N/A N/A N/A r owner op N/A tensor mul N/A N/A not_is_1 N/A i N/A i N/A N/A r owner inputs N/A N/A _is_1 i N/A N/A N/A len not_is_1 1 N/A N/A N/A not_is_1 N/A 0 N/A N/A logsigm_to_softplus N/A N/A gof PatternSub N/A N/A tensor log N/A sigmoid x N/A N/A tensor neg N/A softplus N/A N/A tensor neg x allow_multiple_clients True values_eq_approx values_eq_approx_remove_inf skip_identities_fn _skip_mul_1 _is_1 N/A N/A expr N/A N/A N/A 

    Returns
    -------
    bool
        True iff expr is a constant close to 1.

     N/A N/A N/A v N/A N/A opt get_scalar_constant_value expr N/A N/A N/A numpy allclose v 1 N/A N/A N/A N/A tensor NotScalarConstantError N/A N/A False N/A N/A log1msigm_to_softplus N/A N/A gof PatternSub N/A N/A tensor log N/A N/A tensor sub N/A dict pattern y constraint _is_1 N/A sigmoid x N/A N/A tensor neg N/A softplus x allow_multiple_clients True values_eq_approx values_eq_approx_remove_inf skip_identities_fn _skip_mul_1 N/A log1pexp_to_softplus N/A N/A gof PatternSub N/A N/A tensor log1p N/A N/A tensor exp x N/A softplus x values_eq_approx values_eq_approx_remove_inf allow_multiple_clients True N/A N/A N/A opt register_stabilize logsigm_to_softplus name logsigm_to_softplus N/A N/A N/A opt register_stabilize log1msigm_to_softplus name log1msigm_to_softplus N/A N/A N/A opt register_stabilize log1pexp_to_softplus name log1pexp_to_softplus is_1pexp N/A N/A t N/A N/A N/A 

    Returns
    -------
    object
        If 't' is of the form (1+exp(x)), return (False, x).
        Else return None.

     N/A N/A N/A t owner N/A N/A N/A t owner op N/A tensor add N/A N/A N/A scalars scalar_inputs nonconsts N/A N/A opt scalarconsts_rest N/A N/A t owner inputs N/A N/A N/A len nonconsts 1 N/A N/A maybe_exp N/A nonconsts N/A 0 N/A N/A N/A maybe_exp owner N/A N/A N/A maybe_exp owner op N/A tensor exp N/A N/A scalars N/A N/A scal_sum N/A scalars N/A 0 N/A s N/A scalars N/A 1 N/A N/A scal_sum N/A scal_sum s N/A N/A N/A numpy allclose scal_sum 1 N/A N/A N/A False N/A N/A N/A maybe_exp owner inputs N/A 0 N/A N/A N/A config warn identify_1pexp_bug N/A N/A N/A N/A 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'. N/A None N/A is_exp N/A N/A var N/A N/A N/A 
    Match a variable with either of the `exp(x)` or `-exp(x)` patterns.

    Parameters
    ----------
    var
        The Variable to analyze.

    Returns
    -------
    tuple
        A pair (b, x) with `b` a boolean set to True if `var` is of the
        form `-exp(x)` and False if `var` is of the form `exp(x)`. If `var`
        cannot be cast into either form, then return `None`.

     N/A neg False N/A neg_info N/A is_neg var N/A N/A neg_info None N/A N/A neg True N/A var neg_info N/A N/A N/A var owner N/A N/A N/A var owner op N/A tensor exp N/A N/A N/A neg N/A N/A N/A var owner inputs N/A 0 N/A is_mul N/A N/A var N/A N/A N/A 
    Match a variable with `x * y * z * ...`.

    Parameters
    ----------
    var
        The Variable to analyze.

    Returns
    -------
    object
        A list [x, y, z, ...] if `var` is of the form `x * y * z * ...`,
        or None if `var` cannot be cast into this form.

     N/A N/A N/A var owner N/A N/A N/A var owner op N/A tensor mul N/A N/A N/A N/A var owner inputs N/A N/A None N/A partition_num_or_denom N/A N/A r f N/A N/A N/A N/A N/A r owner N/A N/A N/A r owner op N/A tensor mul N/A N/A a N/A N/A r owner inputs N/A N/A a N/A r N/A f_terms N/A N/A neg False N/A rest N/A N/A t a N/A N/A f_t N/A f t N/A N/A f_t None N/A N/A N/A N/A rest append t N/A N/A N/A neg_t f_t f_t N/A N/A N/A f_terms append f_t N/A neg neg_t N/A N/A f_terms rest neg N/A is_neg N/A N/A var N/A N/A N/A 
    Match a variable with the `-x` pattern.

    Parameters
    ----------
    var
        The Variable to analyze.

    Returns
    -------
    object
        `x` if `var` is of the form `-x`, or None otherwise.

     N/A apply N/A var owner N/A N/A apply N/A N/A None N/A N/A N/A apply op N/A tensor neg N/A N/A N/A N/A apply inputs N/A 0 N/A N/A N/A N/A apply op N/A tensor mul N/A N/A len N/A apply inputs 2 N/A N/A N/A idx mul_input N/A enumerate N/A apply inputs N/A N/A N/A N/A constant N/A N/A opt get_scalar_constant_value mul_input N/A is_minus_1 N/A N/A numpy allclose constant -1 N/A N/A N/A NotScalarConstantError N/A N/A is_minus_1 False N/A is_minus_1 N/A N/A N/A N/A len N/A apply inputs 2 N/A N/A N/A N/A apply inputs N/A N/A 1 idx N/A N/A N/A N/A tensor mul N/A N/A N/A apply inputs N/A 0 idx N/A N/A apply inputs N/A N/A idx 1 N/A None N/A local_exp_over_1_plus_exp N/A N/A node N/A N/A N/A 
    exp(x)/(1+exp(x)) -> sigm(x)
    c/(1+exp(x)) -> c*sigm(-x)

     N/A N/A N/A node op N/A tensor true_div N/A N/A N/A num denom N/A node inputs N/A N/A num_exp_x num_rest num_neg N/A partition_num_or_denom num is_exp N/A N/A denom_1pexp denom_rest denom_neg N/A partition_num_or_denom denom is_1pexp N/A sigmoids N/A N/A t denom_1pexp N/A N/A N/A t num_exp_x N/A N/A N/A N/A sigmoids append N/A sigmoid t N/A N/A num_exp_x N/A N/A N/A num_exp_x index t N/A N/A N/A N/A sigmoids append N/A sigmoid N/A t N/A N/A sigmoids N/A N/A N/A new_num N/A N/A sigmoids N/A N/A N/A tensor exp t N/A t num_exp_x num_rest N/A N/A N/A len new_num 1 N/A N/A new_num N/A new_num N/A 0 N/A N/A new_num N/A N/A tensor mul new_num N/A N/A num_neg denom_neg N/A N/A new_num N/A new_num N/A N/A N/A len denom_rest 0 N/A N/A N/A new_num N/A N/A N/A N/A len denom_rest 1 N/A N/A N/A N/A new_num N/A denom_rest N/A 0 N/A N/A N/A N/A new_num N/A N/A tensor mul denom_rest N/A N/A opt register_stabilize N/A N/A gof local_optimizer N/A N/A tensor true_div parse_mul_tree N/A N/A root N/A N/A N/A 
    Parse a tree of multiplications starting at the given root.

    Parameters
    ----------
    root
        The variable at the root of the tree.

    Returns
    -------
    object
        A tree where each non-leaf node corresponds to a multiplication
        in the computation of `root`, represented by the list of its inputs.
        Each input is a pair [n, x] with `n` a boolean value indicating whether
        sub-tree `x` should be negated.

    Examples
    --------
        x * y               -> [False, [[False, x], [False, y]]]
        -(x * y)            -> [True, [[False, x], [False, y]]]
        -x * y              -> [False, [[True, x], [False, y]]]
        -x                  -> [True, x]
        (x * y) * -z        -> [False, [[False, [[False, x], [False, y]]],
                                        [True, z]]]

     N/A mul_info N/A is_mul root N/A N/A mul_info None N/A N/A neg_info N/A is_neg root N/A N/A neg_info None N/A N/A N/A False root N/A N/A N/A neg sub_tree N/A parse_mul_tree neg_info N/A N/A N/A neg sub_tree N/A N/A N/A False N/A list N/A map parse_mul_tree mul_info N/A replace_leaf N/A N/A arg leaves new_leaves op neg N/A N/A N/A 
    Attempt to replace a leaf of a multiplication tree.

    We search for a leaf in `leaves` whose argument is `arg`, and if we find
    one, we remove it from `leaves` and add to `new_leaves` a leaf with
    argument `arg` and variable `op(arg)`.

    Parameters
    ----------
    arg
        The argument of the leaf we are looking for.
    leaves
        List of leaves to look into. Each leaf should be a pair
        (x, l) with `x` the argument of the Op found in the leaf, and `l` the
        actual leaf as found in a multiplication tree output by `parse_mul_tree`
        (i.e. a pair [boolean, variable]).
    new_leaves
        If a replacement occurred, then the leaf is removed from `leaves`
        and added to the list `new_leaves` (after being modified by `op`).
    op
        A function that, when applied to `arg`, returns the Variable
        we want to replace the original leaf variable with.
    neg : bool
        If True, then the boolean value associated to the leaf should
        be swapped. If False, then this value should remain unchanged.

    Returns
    -------
    bool
        True if a replacement occurred, or False otherwise.

     N/A N/A idx x N/A enumerate leaves N/A N/A N/A N/A x N/A 0 arg N/A N/A N/A N/A x N/A 1 N/A 0 neg N/A N/A N/A x N/A 1 N/A 1 N/A op arg N/A N/A N/A leaves pop idx N/A N/A N/A new_leaves append x N/A True N/A False N/A simplify_mul N/A N/A tree N/A N/A N/A 
    Simplify a multiplication tree.

    Parameters
    ----------
    tree
        A multiplication tree (as output by `parse_mul_tree`).

    Returns
    -------
    object
        A multiplication tree computing the same output as `tree` but without
        useless multiplications by 1 nor -1 (identified by leaves of the form
        [False, None] or [True, None] respectively). Useless multiplications
        (with less than two inputs) are also removed from the tree.

     N/A N/A neg inputs tree N/A N/A isinstance inputs list N/A N/A s_inputs N/A N/A s_i N/A imap simplify_mul inputs N/A N/A N/A N/A s_i N/A 1 None N/A N/A neg N/A s_i N/A 0 N/A N/A N/A N/A s_inputs append s_i N/A N/A s_inputs N/A N/A rval N/A neg None N/A N/A N/A N/A len s_inputs 1 N/A N/A N/A N/A s_inputs N/A 0 N/A 0 neg N/A rval N/A s_inputs N/A 0 N/A N/A rval N/A neg s_inputs N/A N/A rval tree N/A rval N/A compute_mul N/A N/A tree N/A N/A N/A 
    Compute the Variable that is the output of a multiplication tree.

    This is the inverse of the operation performed by `parse_mul_tree`, i.e.
    compute_mul(parse_mul_tree(tree)) == tree.

    Parameters
    ----------
    tree
        A multiplication tree (as output by `parse_mul_tree`).

    Returns
    -------
    object
        A Variable that computes the multiplication represented by the tree.

     N/A N/A neg inputs tree N/A N/A inputs None N/A N/A N/A AssertionError Function `compute_mul` found a missing leaf, did you forget to call `simplify_mul` on the tree first? N/A N/A N/A isinstance inputs list N/A N/A rval N/A N/A tensor mul N/A list N/A map compute_mul inputs N/A N/A rval inputs N/A neg N/A N/A rval N/A rval N/A rval N/A perform_sigm_times_exp N/A N/A tree exp_x exp_minus_x sigm_x sigm_minus_x parent child_idx full_tree N/A None None None None None None None N/A N/A 
    Core processing of the `local_sigm_times_exp` optimization.

    This recursive function operates on a multiplication tree as output by
    `parse_mul_tree`. It walks through the tree and modifies it in-place
    by replacing matching pairs (exp, sigmoid) with the desired optimized
    version.

    Parameters
    ----------
    tree
        The sub-tree to operate on.
    exp_x
        List of arguments x so that `exp(x)` exists somewhere in the whole
        multiplication tree. Each argument is a pair (x, leaf) with `x` the
        argument of the exponential, and `leaf` the corresponding leaf in the
        multiplication tree (of the form [n, exp(x)] -- see `parse_mul_tree`).
        If None, this argument is initialized to an empty list.
    exp_minus_x
        Similar to `exp_x`, but for `exp(-x)`.
    sigm_x
        Similar to `exp_x`, but for `sigmoid(x)`.
    sigm_minus_x
        Similar to `exp_x`, but for `sigmoid(-x)`.
    parent
        Parent of `tree` (None if `tree` is the global root).
    child_idx
        Index of `tree` in its parent's inputs (None if `tree` is the global
        root).
    full_tree
        The global multiplication tree (should not be set except by recursive
        calls to this function). Used for debugging only.

    Returns
    -------
    bool
        True if a modification was performed somewhere in the whole multiplication
        tree, or False otherwise.

     N/A N/A exp_x None N/A N/A exp_x N/A N/A N/A exp_minus_x None N/A N/A exp_minus_x N/A N/A N/A sigm_x None N/A N/A sigm_x N/A N/A N/A sigm_minus_x None N/A N/A sigm_minus_x N/A N/A N/A full_tree None N/A N/A full_tree tree N/A False N/A N/A N/A print <perform_sigm_times_exp> N/A N/A print N/A   full_tree   = %s full_tree N/A N/A print N/A   tree        = %s tree N/A N/A print N/A   exp_x       = %s exp_x N/A N/A print N/A   exp_minus_x = %s exp_minus_x N/A N/A print N/A   sigm_x      = %s sigm_x N/A N/A print N/A   sigm_minus_x= %s sigm_minus_x N/A N/A neg inputs tree N/A N/A isinstance inputs list N/A N/A rval False N/A N/A sub_idx sub_tree N/A enumerate inputs N/A N/A rval N/A perform_sigm_times_exp tree sub_tree parent tree child_idx sub_idx exp_x exp_x exp_minus_x exp_minus_x sigm_x sigm_x sigm_minus_x sigm_minus_x full_tree full_tree N/A rval N/A N/A var inputs N/A keep_it False N/A exp_info N/A is_exp var N/A N/A exp_info None N/A N/A N/A exp_neg exp_arg exp_info N/A neg exp_neg N/A neg_arg N/A is_neg exp_arg N/A N/A neg_arg None N/A N/A N/A N/A replace_leaf exp_arg sigm_minus_x sigm_x sigmoid neg N/A N/A N/A N/A exp_x append N/A exp_arg tree N/A keep_it True N/A N/A N/A N/A replace_leaf neg_arg sigm_x sigm_minus_x N/A N/A N/A x N/A N/A sigmoid N/A x neg N/A N/A N/A N/A exp_minus_x append N/A neg_arg tree N/A keep_it True N/A N/A N/A N/A var owner N/A N/A N/A var owner op sigmoid N/A N/A sigm_arg N/A N/A N/A var owner inputs N/A 0 N/A neg_arg N/A is_neg sigm_arg N/A N/A neg_arg None N/A N/A N/A N/A replace_leaf sigm_arg exp_minus_x sigm_minus_x N/A N/A N/A x N/A N/A sigmoid N/A x neg N/A N/A N/A N/A sigm_x append N/A sigm_arg tree N/A keep_it True N/A N/A N/A N/A replace_leaf neg_arg exp_x sigm_x sigmoid neg N/A N/A N/A N/A sigm_minus_x append N/A neg_arg tree N/A keep_it True N/A N/A keep_it True N/A N/A keep_it N/A N/A N/A parent None N/A N/A N/A parent N/A 1 N/A child_idx N/A False None N/A N/A keep_it N/A local_sigm_times_exp N/A N/A node N/A N/A N/A 
    exp(x) * sigm(-x) -> sigm(x)
    exp(-x) * sigm(x) -> sigm(-x)

     N/A N/A N/A node op N/A tensor mul N/A N/A None N/A mul_tree N/A parse_mul_tree N/A N/A node outputs N/A 0 N/A did_something N/A perform_sigm_times_exp mul_tree N/A N/A did_something N/A N/A None N/A mul_tree N/A simplify_mul mul_tree N/A out N/A compute_mul mul_tree N/A N/A copy_stack_trace N/A N/A node outputs N/A 0 out N/A N/A out N/A N/A opt register_stabilize N/A N/A gof local_optimizer N/A N/A tensor mul local_inv_1_plus_exp N/A N/A node N/A N/A N/A 
    1/(1+exp(x)) -> sigm(-x)

     N/A N/A N/A node op N/A tensor inv N/A N/A inv_arg N/A N/A node inputs N/A 0 N/A N/A N/A inv_arg owner N/A N/A N/A inv_arg owner op N/A tensor add N/A N/A N/A scalars scalar_inputs nonconsts N/A N/A opt scalarconsts_rest N/A N/A inv_arg owner inputs N/A N/A N/A len nonconsts 1 N/A N/A N/A N/A N/A nonconsts N/A 0 owner N/A N/A N/A N/A nonconsts N/A 0 owner op N/A tensor exp N/A N/A N/A scalars N/A N/A numpy allclose N/A N/A numpy sum scalars 1 N/A N/A out N/A N/A opt _fill_chain N/A sigmoid N/A N/A tensor neg N/A N/A N/A N/A nonconsts N/A 0 owner inputs N/A 0 scalar_inputs N/A N/A copy_stack_trace N/A N/A nonconsts N/A 0 inv_arg N/A N/A node outputs N/A 0 out N/A out N/A N/A opt register_stabilize N/A N/A gof local_optimizer N/A N/A tensor inv local_1msigmoid N/A N/A node N/A N/A N/A 
    1-sigm(x) -> sigm(-x)

     N/A N/A N/A node op N/A tensor sub N/A N/A N/A sub_l sub_r N/A node inputs N/A N/A N/A len N/A sub_r clients 1 N/A N/A N/A N/A N/A sub_r owner N/A N/A N/A sub_r owner op sigmoid N/A N/A N/A N/A val_l N/A N/A opt get_scalar_constant_value sub_l N/A N/A N/A Exception N/A N/A N/A N/A N/A numpy allclose N/A N/A numpy sum val_l 1 N/A N/A out N/A sigmoid N/A N/A N/A N/A sub_r owner inputs N/A 0 N/A N/A copy_stack_trace N/A sub_r N/A N/A node outputs N/A 0 out N/A N/A out N/A N/A N/A gof local_optimizer N/A N/A tensor sub N/A register_local_1msigmoid False N/A register_local_1msigmoid N/A N/A N/A N/A opt register_canonicalize local_1msigmoid N/A 0 N/A local_sigm_gest N/A N/A node N/A N/A N/A N/A print CANONICALIZE N/A N/A print N/A sigm_canonicalize node N/A N/A opt register_stabilize N/A N/A gof local_optimizer N/A N/A tensor mul sigm_canonicalize N/A N/A node N/A N/A N/A mul N/A tensor mul N/A div N/A tensor true_div N/A N/A N/A node op N/A tensor add N/A N/A rval N/A N/A i N/A node inputs N/A N/A rval N/A sigm_canonicalize i N/A rval N/A N/A N/A node op N/A tensor mul N/A N/A rval N/A sigm_canonicalize N/A N/A node inputs N/A 0 N/A i N/A N/A node inputs N/A 1 N/A N/A old_rval rval N/A rval N/A N/A t1 N/A sigm_canonicalize i N/A N/A t0 old_rval N/A N/A N/A N/A N/A t1 owner op div N/A N/A N/A N/A t0 owner op div N/A N/A t0top t0bot N/A N/A t0 owner inputs N/A N/A t1top t1bot N/A N/A t1 owner inputs N/A N/A N/A rval append N/A div N/A mul N/A t0top t1top N/A mul N/A t0bot t1bot N/A N/A N/A len rval 100 N/A N/A N/A N/A N/A N/A N/A len N/A node outputs 1 N/A N/A N/A N/A N/A N/A N/A N/A node outputs N/A 0 N/A