# Path: deep_architect/contrib/misc/search_spaces/tensorflow/common.py
# D = hp.Discrete
# def siso_tensorflow_module(name, compile_fn, name_to_hyperp, scope=None):


import tensorflow as tf
import numpy as np
import deep_architect.modules as mo
import deep_architect.hyperparameters as hp
import deep_architect.searchers.random as se
import deep_architect.core as co
from deep_architect.contrib.misc.search_spaces.tensorflow.common import siso_tfm


D = hp.Discrete  # Discrete Hyperparameter


def dense(h_units):

    def compile_fn(di, dh):  # compile function
        Dense = tf.keras.layers.Dense(dh['units'])

        def fn(di):  # forward function
            return {'out': Dense(di['in'])}

        return fn

    return siso_tfm('Dense', compile_fn, {'units': h_units})


def flatten():

    def compile_fn(di, dh):
        Flatten = tf.keras.layers.Flatten()

        def fn(di):
            return {'out': Flatten(di['in'])}

        return fn


# Path: deep_architect/contrib/misc/search_spaces/tensorflow/common.py
# D = hp.Discrete
# def siso_tensorflow_module(name, compile_fn, name_to_hyperp, scope=None):


# Path: dev/tutorials/mnist/tensorflow/mnist_tf_keras.py
import tensorflow as tf
import numpy as np
import deep_architect.modules as mo
import deep_architect.hyperparameters as hp
import deep_architect.searchers.random as se
import deep_architect.core as co
from deep_architect.contrib.misc.search_spaces.tensorflow.common import siso_tfm



D = hp.Discrete  # Discrete Hyperparameter


def dense(h_units):

    def compile_fn(di, dh):  # compile function
        Dense = tf.keras.layers.Dense(dh['units'])

        def fn(di):  # forward function
            return {'out': Dense(di['in'])}

        return fn

    return siso_tfm('Dense', compile_fn, {'units': h_units})


def flatten():

    def compile_fn(di, dh):
        Flatten = tf.keras.layers.Flatten()

        def fn(di):
            return {'out': Flatten(di['in'])}

        return fn


    return siso_tfm('Flatten', compile_fn, {})