Skip to content

Commit c960273

Browse files
authored
Switch view() with reshape() on equalize (#6772)
1 parent 88b6b93 commit c960273

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

torchvision/prototype/transforms/functional/_color.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def equalize_image_tensor(image: torch.Tensor) -> torch.Tensor:
227227
if image.numel() == 0:
228228
return image
229229

230-
return _equalize_image_tensor_vec(image.view(-1, height, width)).view(image.shape)
230+
return _equalize_image_tensor_vec(image.view(-1, height, width)).reshape(image.shape)
231231

232232

233233
equalize_image_pil = _FP.equalize

torchvision/transforms/functional_tensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ def _scale_channel(img_chan: Tensor) -> Tensor:
875875
if img_chan.is_cuda:
876876
hist = torch.histc(img_chan.to(torch.float32), bins=256, min=0, max=255)
877877
else:
878-
hist = torch.bincount(img_chan.view(-1), minlength=256)
878+
hist = torch.bincount(img_chan.reshape(-1), minlength=256)
879879

880880
nonzero_hist = hist[hist != 0]
881881
step = torch.div(nonzero_hist[:-1].sum(), 255, rounding_mode="floor")

0 commit comments

Comments
 (0)