06dc59afe4657c009430a4673f1504feb69d2736,torchtext/data/batch.py,Batch,__init__,#Batch#Any#Any#Any#,21
Before Change
self.target_fields = [k for k, v in dataset.fields.items() if
v is not None and v.is_target]
for (name, field) in dataset.fields.items():
if field is not None:
batch = [getattr(x, name) for x in data]
setattr(self, name, field.process(batch, device=device))
@classmethod
def fromvars(cls, dataset, batch_size, train=None, **kwargs):
Create a Batch directly from a number of Variables.
batch = cls()
After Change
warnings.warn("{} class has ".format(self.__class__.__name__) +
"been retired and moved to torchtext.legacy. Please " +
"import from torchtext.legacy.data if you still want it.", UserWarning)
raise ImportWarning
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances Project Name: pytorch/text
Commit Name: 06dc59afe4657c009430a4673f1504feb69d2736
Time: 2021-02-17
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: torchtext/data/batch.py
Class Name: Batch
Method Name: __init__
Project Name: pytorch/text
Commit Name: 06dc59afe4657c009430a4673f1504feb69d2736
Time: 2021-02-17
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: torchtext/data/example.py
Class Name: Example
Method Name: fromdict
Project Name: pytorch/text
Commit Name: 06dc59afe4657c009430a4673f1504feb69d2736
Time: 2021-02-17
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: torchtext/data/example.py
Class Name: Example
Method Name: fromJSON