cf7ed441052a1514bc7747661011944043d95206,inferno/io/transform/generic.py,AsTorchBatch,tensor_function,#AsTorchBatch#Any#,153
Before Change
return torch.from_numpy(tensor[None, ...])
else:
// Channel axis is in already
return torch.from_numpy(tensor)
elif self.dimensionality == 1:
// We"re dealing with a vector - it has to be 1D
assert tensor.ndim == 1
return torch.from_numpy(tensor)
After Change
def tensor_function(self, tensor):
assert isinstance(tensor, (list, np.ndarray)), "Expected numpy array or list, got %s" % type(tensor)
if isinstance(tensor, np.ndarray):
return self._to_batch(tensor)
else:
return [self._to_batch(elem) for elem in tensor]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances Project Name: inferno-pytorch/inferno
Commit Name: cf7ed441052a1514bc7747661011944043d95206
Time: 2018-08-14
Author: constantin.pape@iwr.uni-heidelberg.de
File Name: inferno/io/transform/generic.py
Class Name: AsTorchBatch
Method Name: tensor_function
Project Name: geomstats/geomstats
Commit Name: 9d6281d3b2f472e5e130dbf88078c433d0795f46
Time: 2020-04-24
Author: ninamio78@gmail.com
File Name: geomstats/_backend/pytorch/__init__.py
Class Name:
Method Name: all
Project Name: descarteslabs/descarteslabs-python
Commit Name: ffd803c1ca1f5c0da2e5ee902e94bb4925b9331d
Time: 2020-03-11
Author: clark@descarteslabs.com
File Name: descarteslabs/workflows/types/numpy/numpy_overrides.py
Class Name:
Method Name: asarray