# Path: minos/model/parameters.py
# def is_custom_activation(name):
#     return name in custom_activations
# 
# def get_custom_activation(name):
#     return custom_activations.get(name, None)
# 
# def is_custom_layer(name):
#     return name in custom_layers
# 
# def get_custom_layer(name):
#     return custom_layers.get(name, None)
# 
# Path: minos/tf_utils.py
# def get_logical_device(physical_device):
#     if is_gpu_device(physical_device):
#         return '/gpu:0'
#     return physical_device
# 
# def cpu_device():
#     return '/cpu:0'


from copy import deepcopy
from keras.engine.topology import Input, Merge, merge
from keras.engine.training import Model
from keras.layers.core import Dense, Lambda
from keras.regularizers import L1L2Regularizer
from minos.model.parameters import is_custom_activation, get_custom_activation,\
    is_custom_layer, get_custom_layer
from minos.tf_utils import get_logical_device, cpu_device
import logging
import traceback
import keras
    import tensorflow as tf
    import tensorflow as tf
        return model(**parameters)(inputs)
    except Exception as ex:
        logging.debug(traceback.format_exc())
        raise ex


def _get_layer_model(layer_type):
    if is_custom_layer(layer_type):
        return get_custom_layer(layer_type)[0]
    modules = [keras.layers, keras.layers.normalization]
    for module in modules:
        model = getattr(module, layer_type)
        if model:
            return model
    return None


def _build_layer_parameters(layer):
    parameters = deepcopy(layer.parameters)
    regularizers = [
        'activity_regularizer',
        'b_regularizer',
        'W_regularizer',
        'gamma_regularizer',
        'beta_regularizer']
    for regularizer in regularizers:
        if regularizer in parameters:
            parameters[regularizer] = _get_regularizer(parameters[regularizer])
    activation = parameters.get('activation', None)
    if activation:

# Path: minos/model/parameters.py
# def is_custom_activation(name):
#     return name in custom_activations
# 
# def get_custom_activation(name):
#     return custom_activations.get(name, None)
# 
# def is_custom_layer(name):
#     return name in custom_layers
# 
# def get_custom_layer(name):
#     return custom_layers.get(name, None)
# 
# Path: minos/tf_utils.py
# def get_logical_device(physical_device):
#     if is_gpu_device(physical_device):
#         return '/gpu:0'
#     return physical_device
# 
# def cpu_device():
#     return '/cpu:0'


# Path: minos/model/build.py
from copy import deepcopy
from keras.engine.topology import Input, Merge, merge
from keras.engine.training import Model
from keras.layers.core import Dense, Lambda
from keras.regularizers import L1L2Regularizer
from minos.model.parameters import is_custom_activation, get_custom_activation,\
    is_custom_layer, get_custom_layer
from minos.tf_utils import get_logical_device, cpu_device
import logging
import traceback
import keras
    import tensorflow as tf
    import tensorflow as tf

        return model(**parameters)(inputs)
    except Exception as ex:
        logging.debug(traceback.format_exc())
        raise ex


def _get_layer_model(layer_type):
    if is_custom_layer(layer_type):
        return get_custom_layer(layer_type)[0]
    modules = [keras.layers, keras.layers.normalization]
    for module in modules:
        model = getattr(module, layer_type)
        if model:
            return model
    return None


def _build_layer_parameters(layer):
    parameters = deepcopy(layer.parameters)
    regularizers = [
        'activity_regularizer',
        'b_regularizer',
        'W_regularizer',
        'gamma_regularizer',
        'beta_regularizer']
    for regularizer in regularizers:
        if regularizer in parameters:
            parameters[regularizer] = _get_regularizer(parameters[regularizer])
    activation = parameters.get('activation', None)
    if activation:

        if is_custom_activation(activation):