# Path: deep_architect/contrib/misc/search_spaces/tensorflow/common.py
# def siso_tensorflow_module(name, compile_fn, name_to_hyperp, scope=None):
#     return htf.TensorflowModule(name, compile_fn, name_to_hyperp, ['in'],
#                                 ['out'], scope).get_io()
# 
# D = hp.Discrete


import deep_architect.modules as mo
import tensorflow as tf
import numpy as np
from deep_architect.contrib.misc.search_spaces.tensorflow.common import siso_tensorflow_module, D
                Out = tf.nn.elu(di['in'])
            elif nonlin_name == 'softplus':
                Out = tf.nn.softplus(di['in'])
            else:
                raise ValueError
            return {"out": Out}

        return forward_fn

    return siso_tensorflow_module('Nonlinearity', compile_fn,
                                  {'nonlin_name': h_nonlin_name})


def dnn_cell(h_num_hidden, h_nonlin_name, h_swap, h_opt_drop, h_opt_bn,
             h_drop_keep_prob):
    return mo.siso_sequential([
        affine_simplified(h_num_hidden),
        nonlinearity(h_nonlin_name),
        mo.siso_permutation([
            lambda: mo.siso_optional(lambda: dropout(h_drop_keep_prob),
                                     h_opt_drop),
            lambda: mo.siso_optional(batch_normalization, h_opt_bn),
        ], h_swap)
    ])


def dnn_net(num_classes):
    h_nonlin_name = D(['relu', 'relu6', 'crelu', 'elu', 'softplus'],
                      name='Mutatable')
    h_swap = D([0, 1], name='Mutatable_sub')

# Path: deep_architect/contrib/misc/search_spaces/tensorflow/common.py
# def siso_tensorflow_module(name, compile_fn, name_to_hyperp, scope=None):
#     return htf.TensorflowModule(name, compile_fn, name_to_hyperp, ['in'],
#                                 ['out'], scope).get_io()
# 
# D = hp.Discrete


# Path: deep_architect/contrib/misc/search_spaces/tensorflow/dnn.py
import deep_architect.modules as mo
import tensorflow as tf
import numpy as np
from deep_architect.contrib.misc.search_spaces.tensorflow.common import siso_tensorflow_module, D

                Out = tf.nn.elu(di['in'])
            elif nonlin_name == 'softplus':
                Out = tf.nn.softplus(di['in'])
            else:
                raise ValueError
            return {"out": Out}

        return forward_fn

    return siso_tensorflow_module('Nonlinearity', compile_fn,
                                  {'nonlin_name': h_nonlin_name})


def dnn_cell(h_num_hidden, h_nonlin_name, h_swap, h_opt_drop, h_opt_bn,
             h_drop_keep_prob):
    return mo.siso_sequential([
        affine_simplified(h_num_hidden),
        nonlinearity(h_nonlin_name),
        mo.siso_permutation([
            lambda: mo.siso_optional(lambda: dropout(h_drop_keep_prob),
                                     h_opt_drop),
            lambda: mo.siso_optional(batch_normalization, h_opt_bn),
        ], h_swap)
    ])


def dnn_net(num_classes):
    h_nonlin_name = D(['relu', 'relu6', 'crelu', 'elu', 'softplus'],
                      name='Mutatable')
    h_swap = D([0, 1], name='Mutatable_sub')

    h_opt_drop = D([0, 1], name='Mutatable_sub')