Exemple #1
0
    def preprocess(self, batch):
        q_seq, history, label = to_batch_seq(batch)
        q_emb_var, q_len = self.embed_layer.gen_x_q_batch(q_seq)
        hs_emb_var, hs_len = self.embed_layer.gen_x_history_batch(history)

        col_seq, tab_seq, par_tab_nums, foreign_keys = to_batch_tables(
            batch, self.table_type)
        from_candidates = to_batch_from_candidates(par_tab_nums, batch)
        col_emb_var, col_name_len, col_len = self.embed_layer.gen_col_batch(
            col_seq)

        input_data = (q_emb_var, q_len, hs_emb_var, hs_len, col_emb_var,
                      col_len, col_name_len, from_candidates)
        gt_data = label

        return input_data, gt_data
Exemple #2
0
    def preprocess(self, batch):
        q_seq, history, label = to_batch_seq(batch)
        q_emb_var, q_len = self.embed_layer.gen_x_q_batch(q_seq)
        hs_emb_var, hs_len = self.embed_layer.gen_x_history_batch(history)

        col_seq, tab_seq, par_tab_nums, foreign_keys = to_batch_tables(batch, self.table_type)
        col_emb_var, col_name_len, col_len = self.embed_layer.gen_col_batch(col_seq)
        gt_col = np.zeros(q_len.shape, dtype=np.int64)
        index = 0
        for item in batch:
            gt_col[index] = item["gt_col"]
            index += 1

        input_data = (q_emb_var, q_len, hs_emb_var, hs_len, col_emb_var, col_len, col_name_len, gt_col)
        gt_data = label

        return input_data, gt_data