2d47f3f4a1ca342baf92c20a3e1d11c9eb80b3d1,word_language_model/main.py,RNNModel,__init__,#RNNModel#Any#Any#Any#Any#,90

Before Change


        // FIXME: is this better than the standard init? probably
        // FIXME: we need better reset_parameters methods in stdlib
        self.encoder.weight.data.uniform_(-initrange, initrange)
        self.decoder.bias.data.fill_(0)
        self.decoder.weight.data.uniform_(-initrange, initrange)

    def __call__(self, hidden, input):
        emb = self.encoder(input)

After Change


def batchify(data, bsz, bptt):
    nbatch = int(math.floor(data.size(0) / bsz / bptt))
    data = data.narrow(0, 0, nbatch * bptt * bsz)
    data = data.view(bsz, -1).t().contiguous()
    if args.cuda:
        data = data.cuda()
    return data

train = batchify(corpus.train, args.batchsize, args.bptt)
valid = batchify(corpus.valid, 10, 1)
test  = batchify(corpus.test,  10, 1)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: OpenNMT/OpenNMT-py
Commit Name: 2d47f3f4a1ca342baf92c20a3e1d11c9eb80b3d1
Time: 2016-10-16
Author: alerer@fb.com
File Name: word_language_model/main.py
Class Name: RNNModel
Method Name: __init__


Project Name: ikostrikov/pytorch-a2c-ppo-acktr
Commit Name: 6abc02b856623613c45f6b07ec29b1a56d28210e
Time: 2018-09-29
Author: ewijmans2@gmail.com
File Name: model.py
Class Name: NNBase
Method Name: __init__