def _build_final_block()

in models/nas_modules.py [0:0]


    def _build_final_block(self):
        """Construct the final block
        """
        dense = deepcopy(self.feat_dim["dense"])
        sparse = deepcopy(self.feat_dim["sparse"])

        # make dicts of all features id (including intermidiate features)
        for block_id in dense:
            if len(dense[block_id]) > 0:
                dense[block_id] = list(range(dense[block_id][0]))
            else:
                dense[block_id] = []
        for block_id in sparse:
            sparse[block_id] = list(range(len(sparse[block_id])))

        # remove the features that has already been used as intermidiate input
        for block_id in range(0, self.num_block):
            dense_feat = self.blocks[block_id].feat_dense_id
            sparse_feat = self.blocks[block_id].feat_sparse_id
            for former_block_id in dense_feat:
                tmp_ids = dense_feat[former_block_id]
                dense[former_block_id] = (
                    (
                        []
                        if tmp_ids == [-1]
                        else list(set(dense[former_block_id]) - set(tmp_ids))
                    )
                    if former_block_id in dense
                    else []
                )
            for former_block_id in sparse_feat:
                tmp_ids = sparse_feat[former_block_id]
                sparse[former_block_id] = (
                    (
                        []
                        if tmp_ids == [-1]
                        else list(set(sparse[former_block_id]) - set(tmp_ids))
                    )
                    if former_block_id in sparse
                    else []
                )

        # convert feature dicts (dense & sparse) to feature configs
        feat_configs = []
        for block_id, feat_list in dense.items():
            if block_id in sparse:
                feat_config = b_config.FeatSelectionConfig(
                    block_id=block_id, dense=feat_list, sparse=sparse[block_id]
                )
            else:
                feat_config = b_config.FeatSelectionConfig(
                    block_id=block_id, dense=feat_list, sparse=[]
                )
            feat_configs.append(feat_config)
        for block_id, feat_list in sparse.items():
            if block_id in dense:
                continue
            else:
                feat_config = b_config.FeatSelectionConfig(
                    block_id=block_id, dense=[], sparse=feat_list
                )
            feat_configs.append(feat_config)

        # construct the MLP block config
        block_config = b_config.BlockConfig(
            mlp_block=b_config.MLPBlockConfig(
                name="MLPBlock",
                block_id=self.num_block + 1,
                arc=[1],
                type=b_config.BlockType(dense=b_config.DenseBlockType()),
                input_feat_config=feat_configs,
                ly_act=False,
            )
        )
        return set_block_from_config(block_config, self.feat_dim)