73cb3ff00533b03ab64127d2287f9bdfe30c035c,kornia/losses/total_variation.py,,total_variation,#Any#,33
Before Change
if not torch.is_tensor(img):
raise TypeError(f"Input type is not a torch.Tensor. Got {type(img)}")
img_shape = img.shape
if len(img_shape) == 3 or len(img_shape) == 4:
pixel_dif1 = img[..., 1:, :] - img[..., :-1, :]
pixel_dif2 = img[..., :, 1:] - img[..., :, :-1]
reduce_axes = (-3, -2, -1)
else:
raise ValueError("Expected input tensor to be of ndim 3 or 4, but got " + str(len(img_shape)))
return pixel_dif1.abs().sum(dim=reduce_axes) + pixel_dif2.abs().sum(dim=reduce_axes)
After Change
if not isinstance(img, torch.Tensor):
raise TypeError(f"Input type is not a torch.Tensor. Got {type(img)}")
if len(img.shape) < 3 or len(img.shape) > 4:
raise ValueError(
f"Expected input tensor to be of ndim 3 or 4, but got {len(img.shape)}."
)
pixel_dif1 = img[..., 1:, :] - img[..., :-1, :]
pixel_dif2 = img[..., :, 1:] - img[..., :, :-1]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 9
Instances
Project Name: arraiy/torchgeometry
Commit Name: 73cb3ff00533b03ab64127d2287f9bdfe30c035c
Time: 2021-01-16
Author: edgar.riba@gmail.com
File Name: kornia/losses/total_variation.py
Class Name:
Method Name: total_variation
Project Name: nipy/dipy
Commit Name: 491868d5bb9c73324cd7ec25f06d1f3499f01072
Time: 2015-07-16
Author: jomaroceguedag@gmail.com
File Name: dipy/align/imaffine.py
Class Name: AffineMap
Method Name: _apply_transform
Project Name: nilearn/nilearn
Commit Name: a7a171748348898e190ac584d47cbf32ffe68500
Time: 2015-11-29
Author: dkamalakarreddy@gmail.com
File Name: nilearn/regions/region_extractor.py
Class Name:
Method Name: _threshold_maps