# Path: tests/context.py



import pprint
import numpy as np
import copy
import pdb
from .context import PROP_MC, PROP_MM
                    val_minus, _ = model.objective_function(params_minus, N, alpha=alpha, prop_mode=prop_mode)

                    di = (val_plus - val_minus) / eps / 2
                    if hasattr(grad_all[name], '__len__'):
                        g = grad_all[name][i]
                    else:
                        g = grad_all[name]
                    print_message('%s i=%d/%d' % (name, i, pshape[0]), g, di)
            else: # len(pshape) = 0
                params_plus = copy.deepcopy(params)
                params_plus[name] += eps
                if fixed_seed:
                    np.random.seed(stoc_seed)
                val_plus, _ = model.objective_function(params_plus, N, alpha=alpha, prop_mode=prop_mode)
                params_minus = copy.deepcopy(params)
                params_minus[name] -= eps
                if fixed_seed:
                    np.random.seed(stoc_seed)
                val_minus, _ = model.objective_function(params_minus, N, alpha=alpha, prop_mode=prop_mode)

                di = (val_plus - val_minus) / eps / 2
                g = grad_all[name]
                print_message('%s' % name, g, di)
        else:
            params_plus = copy.deepcopy(params)
            params_plus[name] += eps
            if fixed_seed:
                np.random.seed(stoc_seed)
            val_plus, _ = model.objective_function(params_plus, N, alpha=alpha, prop_mode=prop_mode)
            params_minus = copy.deepcopy(params)

# Path: tests/context.py



# Path: tests/test_utils.py
import pprint
import numpy as np
import copy
import pdb
from .context import PROP_MC, PROP_MM

                    val_minus, _ = model.objective_function(params_minus, N, alpha=alpha, prop_mode=prop_mode)

                    di = (val_plus - val_minus) / eps / 2
                    if hasattr(grad_all[name], '__len__'):
                        g = grad_all[name][i]
                    else:
                        g = grad_all[name]
                    print_message('%s i=%d/%d' % (name, i, pshape[0]), g, di)
            else: # len(pshape) = 0
                params_plus = copy.deepcopy(params)
                params_plus[name] += eps
                if fixed_seed:
                    np.random.seed(stoc_seed)
                val_plus, _ = model.objective_function(params_plus, N, alpha=alpha, prop_mode=prop_mode)
                params_minus = copy.deepcopy(params)
                params_minus[name] -= eps
                if fixed_seed:
                    np.random.seed(stoc_seed)
                val_minus, _ = model.objective_function(params_minus, N, alpha=alpha, prop_mode=prop_mode)

                di = (val_plus - val_minus) / eps / 2
                g = grad_all[name]
                print_message('%s' % name, g, di)
        else:
            params_plus = copy.deepcopy(params)
            params_plus[name] += eps
            if fixed_seed:
                np.random.seed(stoc_seed)
            val_plus, _ = model.objective_function(params_plus, N, alpha=alpha, prop_mode=prop_mode)
            params_minus = copy.deepcopy(params)

            params_minus[name] -= eps