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
if hasattr(tensor, "data"):
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: 4
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: scipy/scipy
Commit Name: 4d1d9c6527b7eecfd1a1a1645f5a877a1609496c
Time: 2007-11-22
Author: cookedm@localhost
File Name: scipy/sandbox/numexpr/compiler.py
Class Name:
Method Name: getType
Project Name: descarteslabs/descarteslabs-python
Commit Name: 947dd34c5a56851f7cde781802e239e9e61c790b
Time: 2020-04-07
Author: 13060286+stephaniegott@users.noreply.github.com
File Name: descarteslabs/workflows/types/numpy/numpy_overrides.py
Class Name:
Method Name: _ufunc_result_type