cf7ed441052a1514bc7747661011944043d95206,inferno/io/transform/generic.py,AsTorchBatch,tensor_function,#AsTorchBatch#Any#,153

Before Change


            assert tensor.ndim in [3, 4]
            if tensor.ndim == 3 and self.add_channel_axis_if_necessary:
                // Add channel axis
                return torch.from_numpy(tensor[None, ...])
            else:
                // Channel axis is in already
                return torch.from_numpy(tensor)
        elif self.dimensionality == 2:
            // We"re dealing with an image. tensor can either be 2D or 3D
            assert tensor.ndim in [2, 3]
            if tensor.ndim == 2 and self.add_channel_axis_if_necessary:
                // Add channel axis
                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)
        else:
            raise NotImplementedError

After Change


        if isinstance(tensor, np.ndarray):
            return self._to_batch(tensor)
        else:
            return [self._to_batch(elem) for elem in tensor]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

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: geomstats/geomstats
Commit Name: e7090934bee8009194dbd93d044e6652ce06a385
Time: 2020-07-27
Author: cshewmake2@gmail.com
File Name: geomstats/_backend/pytorch/linalg.py
Class Name:
Method Name: eigh