Unverified Commit c960273c authored by Vasilis Vryniotis's avatar Vasilis Vryniotis Committed by GitHub
Browse files

Switch `view()` with `reshape()` on equalize (#6772)

parent 88b6b93d
...@@ -227,7 +227,7 @@ def equalize_image_tensor(image: torch.Tensor) -> torch.Tensor: ...@@ -227,7 +227,7 @@ def equalize_image_tensor(image: torch.Tensor) -> torch.Tensor:
if image.numel() == 0: if image.numel() == 0:
return image return image
return _equalize_image_tensor_vec(image.view(-1, height, width)).view(image.shape) return _equalize_image_tensor_vec(image.view(-1, height, width)).reshape(image.shape)
equalize_image_pil = _FP.equalize equalize_image_pil = _FP.equalize
......
...@@ -875,7 +875,7 @@ def _scale_channel(img_chan: Tensor) -> Tensor: ...@@ -875,7 +875,7 @@ def _scale_channel(img_chan: Tensor) -> Tensor:
if img_chan.is_cuda: if img_chan.is_cuda:
hist = torch.histc(img_chan.to(torch.float32), bins=256, min=0, max=255) hist = torch.histc(img_chan.to(torch.float32), bins=256, min=0, max=255)
else: else:
hist = torch.bincount(img_chan.view(-1), minlength=256) hist = torch.bincount(img_chan.reshape(-1), minlength=256)
nonzero_hist = hist[hist != 0] nonzero_hist = hist[hist != 0]
step = torch.div(nonzero_hist[:-1].sum(), 255, rounding_mode="floor") step = torch.div(nonzero_hist[:-1].sum(), 255, rounding_mode="floor")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment