# Path: deep_architect/searchers/common.py
# def random_specify(outputs):
#     """Chooses random values to all the unspecified hyperparameters.
# 
#     The hyperparameters will be specified after this call, meaning that the
#     compile and forward functionalities will be available for being called.
# 
#     Args:
#         outputs (dict[str, deep_architect.core.Output]): Dictionary of named
#             outputs which by being traversed back will reach all the modules
#             in the search space, and correspondingly all the current
#             unspecified hyperparameters of the search space.
#     """
#     hyperp_value_lst = []
#     for h in co.unassigned_independent_hyperparameter_iterator(outputs):
#         v = random_specify_hyperparameter(h)
#         hyperp_value_lst.append(v)
#     return hyperp_value_lst


import deep_architect.core as co
import deep_architect.modules as mo
import deep_architect.hyperparameters as hp
import deep_architect.utils as ut
import deep_architect.helpers.keras_support as hke
import deep_architect.visualization as vi
from deep_architect.searchers.common import random_specify
from keras.layers import Conv2D, BatchNormalization, Input, Add
from keras.models import Model
            # final connection to the output node
            in_ids = []
            for i in range(num_nodes):
                if i not in node_ids_to_ignore and i not in node_ids_used:
                    in_ids.append(i)
            num_inputs = len(in_ids)
            if num_inputs > 1:
                (s_inputs, s_outputs) = combine_with_sum(num_inputs)
                for idx, j in enumerate(in_ids):
                    j_outputs = node_id_to_outputs[j]
                    s_inputs["in%d" % idx].connect(j_outputs["out"])
            else:
                j = in_ids[0]
                s_outputs = node_id_to_outputs[j]

            (out_inputs, out_outputs) = conv2d_cell(filters, kernel_size)
            out_inputs["in"].connect(s_outputs["out"])
            return (in_inputs, out_outputs)

        else:
            # all zeros encoded.
            return conv2d_cell(filters, kernel_size)

    name_to_hyperp = {
        ut.json_object_to_json_string({
            "node_id": i,
            "in_node_id": j
        }): D([0, 1]) for i in range(num_nodes) for j in range(i)
    }
    return mo.substitution_module("ConvStage",

# Path: deep_architect/searchers/common.py
# def random_specify(outputs):
#     """Chooses random values to all the unspecified hyperparameters.
# 
#     The hyperparameters will be specified after this call, meaning that the
#     compile and forward functionalities will be available for being called.
# 
#     Args:
#         outputs (dict[str, deep_architect.core.Output]): Dictionary of named
#             outputs which by being traversed back will reach all the modules
#             in the search space, and correspondingly all the current
#             unspecified hyperparameters of the search space.
#     """
#     hyperp_value_lst = []
#     for h in co.unassigned_independent_hyperparameter_iterator(outputs):
#         v = random_specify_hyperparameter(h)
#         hyperp_value_lst.append(v)
#     return hyperp_value_lst


# Path: dev/tutorials/search_spaces_in_the_literature/main_genetic.py
import deep_architect.core as co
import deep_architect.modules as mo
import deep_architect.hyperparameters as hp
import deep_architect.utils as ut
import deep_architect.helpers.keras_support as hke
import deep_architect.visualization as vi
from deep_architect.searchers.common import random_specify
from keras.layers import Conv2D, BatchNormalization, Input, Add
from keras.models import Model

            # final connection to the output node
            in_ids = []
            for i in range(num_nodes):
                if i not in node_ids_to_ignore and i not in node_ids_used:
                    in_ids.append(i)
            num_inputs = len(in_ids)
            if num_inputs > 1:
                (s_inputs, s_outputs) = combine_with_sum(num_inputs)
                for idx, j in enumerate(in_ids):
                    j_outputs = node_id_to_outputs[j]
                    s_inputs["in%d" % idx].connect(j_outputs["out"])
            else:
                j = in_ids[0]
                s_outputs = node_id_to_outputs[j]

            (out_inputs, out_outputs) = conv2d_cell(filters, kernel_size)
            out_inputs["in"].connect(s_outputs["out"])
            return (in_inputs, out_outputs)

        else:
            # all zeros encoded.
            return conv2d_cell(filters, kernel_size)

    name_to_hyperp = {
        ut.json_object_to_json_string({
            "node_id": i,
            "in_node_id": j
        }): D([0, 1]) for i in range(num_nodes) for j in range(i)
    }
    return mo.substitution_module("ConvStage",

                                  substitution_fn,