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()

        return x, xch, lengths, y

    def forward(self, input):
        // BxTxC
        x = input[0]

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)
            if self.gpu is not None:
                y = y.cuda()
            example_dict["y"] = y

        return example_dict

    def forward(self, input):
        // BxTxC
        embeddings = self._embed(input)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 16

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: 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


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: dpressel/mead-baseline
Commit Name: 348b4a63399972a0276d4a7d2beb0cdf191da5d4
Time: 2018-09-30
Author: dpressel@gmail.com
File Name: python/baseline/dy/lm/model.py
Class Name: CharCompLanguageModel
Method Name: make_input