# 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
def constant_initializer(c):

    def init_fn(shape):
        return tf.constant(c, shape=shape)

    return init_fn


def truncated_normal_initializer(stddev):

    def init_fn(shape):
        return tf.truncated_normal(shape, stddev=stddev)

    return init_fn


def xavier_initializer_affine(gain=1.0):

    def init_fn(shape):
        n, m = shape

        sc = gain * (np.sqrt(6.0) / np.sqrt(m + n))
        init_vals = tf.random_uniform([n, m], -sc, sc)
        return init_vals

    return init_fn


# modules
def relu():

# 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

def constant_initializer(c):

    def init_fn(shape):
        return tf.constant(c, shape=shape)

    return init_fn


def truncated_normal_initializer(stddev):

    def init_fn(shape):
        return tf.truncated_normal(shape, stddev=stddev)

    return init_fn


def xavier_initializer_affine(gain=1.0):

    def init_fn(shape):
        n, m = shape

        sc = gain * (np.sqrt(6.0) / np.sqrt(m + n))
        init_vals = tf.random_uniform([n, m], -sc, sc)
        return init_vals

    return init_fn


# modules
def relu():

    return siso_tensorflow_module(