2eb4c5f77bd8da9b1e23851b0acb84543e442953,python/baseline/pytorch/classify/model.py,WordClassifierModelBase,make_input,#WordClassifierModelBase#Any#,61
Before Change
super(WordClassifierBase, self).__init__()
def make_input(self, batch_dict):
x = batch_dict["x"]
xch = batch_dict.get("xch")
y = batch_dict.get("y")
lengths = batch_dict.get("lengths")
if self.gpu:
x = x.cuda()
if xch is not None:
xch = xch.cuda()
if y is not None:
y = y.cuda()
After Change
:param do_dropout: (``bool``) Should we do dropout. Defaults to False
:return:
example_dict = dict({} )
for key in self.embeddings.keys():
example_dict[key] = torch.from_numpy(batch_dict[key])
if self.gpu:
example_dict[key] = example_dict[key].cuda()
// Allow us to track a length, which is needed for BLSTMs
if self.lengths_key is not None:
example_dict["lengths"] = torch.from_numpy(batch_dict[self.lengths_key])
if self.gpu:
example_dict["lengths"] = example_dict["lengths"].cuda()
y = batch_dict.get("y")
if y is not None:
y = torch.from_numpy(y)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances Project Name: dpressel/mead-baseline
Commit Name: 2eb4c5f77bd8da9b1e23851b0acb84543e442953
Time: 2018-09-24
Author: dpressel@gmail.com
File Name: python/baseline/pytorch/classify/model.py
Class Name: WordClassifierModelBase
Method Name: make_input
Project Name: jindongwang/transferlearning
Commit Name: 376b01c2e338ec63e638f62a76d67f6a9323e47c
Time: 2019-08-14
Author: jindongwang@outlook.com
File Name: code/deep/DeepCoral/DeepCoral.py
Class Name:
Method Name:
Project Name: dpressel/mead-baseline
Commit Name: 7a4f4148317f7274c0c88095c037e93f95b1d00d
Time: 2018-09-25
Author: dpressel@gmail.com
File Name: python/baseline/pytorch/lm/model.py
Class Name: AbstractLanguageModel
Method Name: make_input