<s> from __future__ import absolute_import <EOL> import scipy . special <EOL> import autograd . numpy as np <EOL> from autograd . core import primitive <EOL> polygamma = primitive ( scipy . special . polygamma ) <EOL> psi = primitive ( scipy . special . psi ) <EOL> digamma = primitive ( scipy . special . digamma ) <EOL> gamma = primitive ( scipy . special . gamma ) <EOL> gammaln = primitive ( scipy . special . gammaln ) <EOL> gammasgn = primitive ( scipy . special . gammasgn ) <EOL> rgamma = primitive ( scipy . special . rgamma ) <EOL> multigammaln = primitive ( scipy . special . multigammaln ) <EOL> gammasgn . defgrad_is_zero ( ) <EOL> polygamma . defgrad_is_zero ( argnums = ( <NUM_LIT:0> , ) ) <EOL> polygamma . defgrad ( lambda ans , n , x : lambda g : g * polygamma ( n + <NUM_LIT:1> , x ) , argnum = <NUM_LIT:1> ) <EOL> psi . defgrad ( lambda ans , x : lambda g : g * polygamma ( <NUM_LIT:1> , x ) ) <EOL> digamma . defgrad ( lambda ans , x : lambda g : g * polygamma ( <NUM_LIT:1> , x ) ) <EOL> gamma . defgrad ( lambda ans , x : lambda g : g * ans * psi ( x ) ) <EOL> gammaln . defgrad ( lambda ans , x : lambda g : g * psi ( x ) ) <EOL> rgamma . defgrad ( lambda ans , x : lambda g : g * psi ( x ) / - gamma ( x ) ) <EOL> multigammaln . defgrad ( lambda ans , a , d : <EOL> lambda g : g * np . sum ( digamma ( np . expand_dims ( a , - <NUM_LIT:1> ) - np . arange ( d ) / <NUM_LIT> ) , - <NUM_LIT:1> ) ) <EOL> multigammaln . defgrad_is_zero ( argnums = ( <NUM_LIT:1> , ) ) <EOL> j0 = primitive ( scipy . special . j0 ) <EOL> y0 = primitive ( scipy . special . y0 ) <EOL> j1 = primitive ( scipy . special . j1 ) <EOL> y1 = primitive ( scipy . special . y1 ) <EOL> jn = primitive ( scipy . special . jn ) <EOL> yn = primitive ( scipy . special . yn ) <EOL> j0 . defgrad ( lambda ans , x : lambda g : - g * j1 ( x ) ) <EOL> y0 . defgrad ( lambda ans , x : lambda g : - g * y1 ( x ) ) <EOL> j1 . defgrad ( lambda ans , x : lambda g : g * ( j0 ( x ) - jn ( <NUM_LIT:2> , x ) ) / <NUM_LIT> ) <EOL> y1 . defgrad ( lambda ans , x : lambda g : g * ( y0 ( x ) - yn ( <NUM_LIT:2> , x ) ) / <NUM_LIT> ) <EOL> jn . defgrad_is_zero ( argnums = ( <NUM_LIT:0> , ) ) <EOL> yn . defgrad_is_zero ( argnums = ( <NUM_LIT:0> , ) ) <EOL> jn . defgrad ( lambda ans , n , x : lambda g : g * ( jn ( n - <NUM_LIT:1> , x ) - jn ( n + <NUM_LIT:1> , x ) ) / <NUM_LIT> , argnum = <NUM_LIT:1> ) <EOL> yn . defgrad ( lambda ans , n , x : lambda g : g * ( yn ( n - <NUM_LIT:1> , x ) - yn ( n + <NUM_LIT:1> , x ) ) / <NUM_LIT> , argnum = <NUM_LIT:1> ) <EOL> inv_root_pi = <NUM_LIT> <EOL> erf = primitive ( scipy . special . erf ) <EOL> erfc = primitive ( scipy . special . erfc ) <EOL> erf . defgrad ( lambda ans , x : lambda g : <NUM_LIT> * g * inv_root_pi * np . exp ( - x ** <NUM_LIT:2> ) ) <EOL> erfc . defgrad ( lambda ans , x : lambda g : - <NUM_LIT> * g * inv_root_pi * np . exp ( - x ** <NUM_LIT:2> ) ) </s>
