d740663af36c1b392d3beedc4c4c2817365ee49f,ch12/train_model.py,,,#,53

Before Change


            for idx, out_seq in enumerate(out_seq_list):
                r = net.decode_teacher(net.get_encoded_item(enc, idx), out_seq)
                net_results.append(r)
                net_targets.extend(out_idx[idx][1:])
                bleu_sum += model.seq_bleu(r, out_idx[idx][1:])
                bleu_count += 1
            results_v = torch.cat(net_results)
            targets_v = Variable(torch.LongTensor(net_targets))

After Change


            net_targets = []
            for idx, out_seq in enumerate(out_seq_list):
                ref_indices = out_idx[idx][1:]
                if random.random() < TEACHER_PROB:
                    r = net.decode_teacher(net.get_encoded_item(enc, idx), out_seq)
                else:
                    r, _ = net.decode_chain_argmax(embeddings, net.get_encoded_item(enc, idx),
                                                   out_seq.data[0], len(ref_indices))
                net_results.append(r)
                net_targets.extend(ref_indices)
                bleu_sum += model.seq_bleu(r, ref_indices)
                bleu_count += 1
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: d740663af36c1b392d3beedc4c4c2817365ee49f
Time: 2018-01-05
Author: max.lapan@gmail.com
File Name: ch12/train_model.py
Class Name:
Method Name:


Project Name: HazyResearch/fonduer
Commit Name: a90a736bf5c13fde732f0769439d769b91f7bf3d
Time: 2018-09-01
Author: lwhsiao@stanford.edu
File Name: src/fonduer/supervision/labeler.py
Class Name: Labeler
Method Name: update


Project Name: sympy/sympy
Commit Name: 0ca22397dc3ec10f6f990d0d17d95e7725a18ea0
Time: 2020-11-25
Author: ehren.m@gmail.com
File Name: sympy/solvers/recurr.py
Class Name:
Method Name: rsolve_hyper