cb287ae46f67324fbd4eb0a6a919673344ac1017,torchtext/data/field.py,NestedField,numericalize,#NestedField#Any#Any#Any#,589
Before Change
numericalized_ex = self.nesting_field.numericalize(
arr, device=device, train=train)
numericalized.append(numericalized_ex)
return torch.stack(numericalized)
class LabelField(Field):
A Label field.
After Change
numericalized_ex = self.nesting_field.numericalize(
arr, device=device, train=train)
numericalized.append(numericalized_ex)
padded_batch = torch.stack(numericalized)
self.nesting_field.include_lengths = True
if self.include_lengths:
sentence_lengths = torch.LongTensor(sentence_lengths)
word_lengths = torch.LongTensor(word_lengths)
if device == -1:
return (padded_batch, sentence_lengths, word_lengths)
else:
return (padded_batch,
sentence_lengths.cuda(device), word_lengths.cuda(device))
return padded_batch
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: pytorch/text
Commit Name: cb287ae46f67324fbd4eb0a6a919673344ac1017
Time: 2018-04-08
Author: yinpenghhz@hotmail.com
File Name: torchtext/data/field.py
Class Name: NestedField
Method Name: numericalize
Project Name: arraiy/torchgeometry
Commit Name: dcd394f4a5bddb1fc97ae4a7224e00147fc110a3
Time: 2020-01-15
Author: diegovd0296@gmail.com
File Name: examples/data_augmentation.py
Class Name: DummyDataset
Method Name: __getitem__
Project Name: arraiy/torchgeometry
Commit Name: 73317ca61e33b42353fc4b3010f586124954ca18
Time: 2019-12-19
Author: diegovd0296@gmail.com
File Name: examples/data_augmentation.py
Class Name: DummyDataset
Method Name: __getitem__