codes/baseline_models.py [176:197]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        qout = torch.bmm(
            qout.unsqueeze(1), self.W.unsqueeze(0).repeat(qout.size(0), 1, 1)
        )
        qout = qout.squeeze(1)
        rep = torch.cat([qout, rout, torch.abs(qout - rout), qout * rout], dim=1)
        ref_score = torch.sigmoid(self.decoder(rep))
        # out = B x 1
        return ref_score

    def calc_ref_scores(self, batch):
        inp, inp_len, y_true, y_len, y_false, y_false_len = batch
        pred_true = self.forward(inp, inp_len, y_true, y_len)
        pred_false = self.forward(inp, inp_len, y_false, y_false_len)
        return pred_true, pred_false

    def calc_nce_scores(self, batch):
        inp, inp_len, y_true, y_true_len, y_falses, y_false_lens = batch
        pred_true = self.forward(inp, inp_len, y_true, y_true_len)
        num_neg_samples = y_falses.size(1)
        pred_falses = []
        for n in range(num_neg_samples):
            pred_falses.append(
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



codes/baseline_models.py [306:327]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        qout = torch.bmm(
            qout.unsqueeze(1), self.W.unsqueeze(0).repeat(qout.size(0), 1, 1)
        )
        qout = qout.squeeze(1)
        rep = torch.cat([qout, rout, torch.abs(qout - rout), qout * rout], dim=1)
        ref_score = torch.sigmoid(self.decoder(rep))
        # out = B x 1
        return ref_score

    def calc_ref_scores(self, batch):
        inp, inp_len, y_true, y_len, y_false, y_false_len = batch
        pred_true = self.forward(inp, inp_len, y_true, y_len)
        pred_false = self.forward(inp, inp_len, y_false, y_false_len)
        return pred_true, pred_false

    def calc_nce_scores(self, batch):
        inp, inp_len, y_true, y_true_len, y_falses, y_false_lens = batch
        pred_true = self.forward(inp, inp_len, y_true, y_true_len)
        num_neg_samples = y_falses.size(1)
        pred_falses = []
        for n in range(num_neg_samples):
            pred_falses.append(
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



