# Path: deeppy/misc/test.py
# def allclose(a, b, rtol=None, atol=None):
# def gradclose(a, b, rtol=None, atol=None):
# def approx_fprime(x, f, eps=None, *args):
#     def __init__(self, array):
# def graph_funs(src, sink, seed=1):
#     def fun(x):
#     def fun_grad(x):
# class BPropableSource(ex.base.Op, ex.base.NoBPropMixin, ex.base.NoFPropMixin):


import itertools
import numpy as np
import deeppy as dp
import deeppy.expr as ex
from deeppy.misc.test import (eps, BPropableSource, approx_fprime, gradclose,
                              graph_funs)


shapes = [(1, 4), (1, 7), (2, 6), (3, 3), (3, 4), (5, 1)]


def test_activations():
    ops = [
        ex.nnet.LeakyReLU, ex.nnet.ReLU, ex.nnet.Sigmoid, ex.nnet.Softmax,
        ex.nnet.Softplus,
    ]
    confs = itertools.product(shapes, ops)
    for shape, op in confs:
        print('%s shape=%s' % (op.__name__.ljust(20), shape))
        src_array = np.random.normal(size=shape).astype(dp.float_)

        if op is ex.nnet.LeakyReLU:

# Path: deeppy/misc/test.py
# def allclose(a, b, rtol=None, atol=None):
# def gradclose(a, b, rtol=None, atol=None):
# def approx_fprime(x, f, eps=None, *args):
#     def __init__(self, array):
# def graph_funs(src, sink, seed=1):
#     def fun(x):
#     def fun_grad(x):
# class BPropableSource(ex.base.Op, ex.base.NoBPropMixin, ex.base.NoFPropMixin):


# Path: test/unit/expr/nnet/test_activation.py
import itertools
import numpy as np
import deeppy as dp
import deeppy.expr as ex
from deeppy.misc.test import (eps, BPropableSource, approx_fprime, gradclose,
                              graph_funs)



shapes = [(1, 4), (1, 7), (2, 6), (3, 3), (3, 4), (5, 1)]


def test_activations():
    ops = [
        ex.nnet.LeakyReLU, ex.nnet.ReLU, ex.nnet.Sigmoid, ex.nnet.Softmax,
        ex.nnet.Softplus,
    ]
    confs = itertools.product(shapes, ops)
    for shape, op in confs:
        print('%s shape=%s' % (op.__name__.ljust(20), shape))
        src_array = np.random.normal(size=shape).astype(dp.float_)

        if op is ex.nnet.LeakyReLU:

            src_array[np.fabs(src_array) < eps] = eps