889b03c66f434b4ea2a281b847751afc760b2c8b,torchtext/data/batch.py,,_short_str,#Any#,63
Before Change
tensor = tensor.data
// fallback in case of wrong argument type
if issubclass(type(tensor), _TensorBase) is False:
return str(tensor)
// copied from torch _tensor_str
size_str = "x".join(str(size) for size in tensor.size())
device_str = "" if not tensor.is_cuda else \
" (GPU {})".format(tensor.get_device())
strt = "[{} of size {}{}]".format(typename(tensor),
After Change
tensor = getattr(tensor, "data")
// (2) handle include_lengths
elif isinstance(tensor, tuple):
return str(tuple(_short_str(t) for t in tensor))
// (3) fallback to default str
else:
return str(tensor)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: pytorch/text
Commit Name: 889b03c66f434b4ea2a281b847751afc760b2c8b
Time: 2018-03-17
Author: martin.tutek@gmail.com
File Name: torchtext/data/batch.py
Class Name:
Method Name: _short_str
Project Name: Microsoft/nni
Commit Name: b7366b685afdde156e551f8ba5008857f789e368
Time: 2019-02-11
Author: 871886504@qq.com
File Name: tools/nni_annotation/code_generator.py
Class Name:
Method Name: test_variable_equal
Project Name: facebookresearch/ParlAI
Commit Name: 9800a9241dbb89ae2ce4b51653ec158ebce799d4
Time: 2017-08-01
Author: ahm@fb.com
File Name: parlai/core/metrics.py
Class Name: Metrics
Method Name: update_ranking_metrics