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, ar gs.bptt)
valid = batchify(corpus.valid, 10, 1)
test = batchify(corpus.test, 10, 1)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances Project Name: pytorch/examples
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: ncullen93/torchsample
Commit Name: 364cd40384ad4f9cda4df949d0b1bd63abdcf6df
Time: 2017-05-05
Author: ncullen.th@dartmouth.edu
File Name: torchsample/transforms/image_transforms.py
Class Name: Contrast
Method Name: __call__