e58d3536e55a1c136d4868fb47593b95eb511534,torchtext/experimental/transforms.py,VocabTransform,forward,#VocabTransform#Any#,197
Before Change
ids: List[List[int]] = []
for tokens in tokens_list:
ids.append(self.vocab.lookup_indices(tokens))
return ids
def to_ivalue(self):
if hasattr(self.vocab, "to_ivalue"):
vocab = self.vocab.to_ivalue()
After Change
>>> vocab_transform(["here", "is", "an", "example"])
return self.vocab.lookup_indices(tokens)
def to_ivalue(self):
if hasattr(self.vocab, "to_ivalue"):
vocab = self.vocab.to_ivalue()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: pytorch/text
Commit Name: e58d3536e55a1c136d4868fb47593b95eb511534
Time: 2020-09-21
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: torchtext/experimental/transforms.py
Class Name: VocabTransform
Method Name: forward
Project Name: pytorch/text
Commit Name: e58d3536e55a1c136d4868fb47593b95eb511534
Time: 2020-09-21
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: examples/data_pipeline/transforms.py
Class Name: PretrainedSPVocab
Method Name: forward
Project Name: pytorch/text
Commit Name: e58d3536e55a1c136d4868fb47593b95eb511534
Time: 2020-09-21
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: torchtext/experimental/vocab.py
Class Name: Vocab
Method Name: forward