f4ca9b361adb382423c753f7f864a5dd0e454964,torchsample/transforms/tensor_transforms.py,RandomCrop,__call__,#RandomCrop#,378

Before Change


    def __call__(self, x, y=None):
        h_idx = random.randint(0,x.size(1)-self.crop_size[0])
        w_idx = random.randint(0,x.size(2)-self.crop_size[1])
        x = x[:, h_idx:(h_idx+self.crop_size[0]),w_idx:(w_idx+self.crop_size[1])]
        if y is not None:
            y = y[:, h_idx:(h_idx+self.crop_size[0]),w_idx:(w_idx+self.crop_size[1])] 
            return x, y
        else:
            return x


class SpecialCrop(object):

    def __init__(self, crop_size, crop_type=0):
        

After Change


    def __call__(self, *inputs):
        h_idx = random.randint(0,inputs[0].size(1)-self.crop_size[0])
        w_idx = random.randint(0,inputs[1].size(2)-self.crop_size[1])
        outputs = []
        for idx, _input in enumerate(inputs):
            _input = _input[:, h_idx:(h_idx+self.crop_size[0]),w_idx:(w_idx+self.crop_size[1])]
            outputs.append(_input)
        return outputs if idx > 1 else outputs[0]


class SpecialCrop(object):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 17

Instances


Project Name: ncullen93/torchsample
Commit Name: f4ca9b361adb382423c753f7f864a5dd0e454964
Time: 2017-05-12
Author: ncullen.th@dartmouth.edu
File Name: torchsample/transforms/tensor_transforms.py
Class Name: RandomCrop
Method Name: __call__


Project Name: ncullen93/torchsample
Commit Name: f4ca9b361adb382423c753f7f864a5dd0e454964
Time: 2017-05-12
Author: ncullen.th@dartmouth.edu
File Name: torchsample/transforms/tensor_transforms.py
Class Name: TypeCast
Method Name: __call__


Project Name: ncullen93/torchsample
Commit Name: f4ca9b361adb382423c753f7f864a5dd0e454964
Time: 2017-05-12
Author: ncullen.th@dartmouth.edu
File Name: torchsample/transforms/tensor_transforms.py
Class Name: ToCuda
Method Name: __call__


Project Name: ncullen93/torchsample
Commit Name: f4ca9b361adb382423c753f7f864a5dd0e454964
Time: 2017-05-12
Author: ncullen.th@dartmouth.edu
File Name: torchsample/transforms/tensor_transforms.py
Class Name: AddChannel
Method Name: __call__