Skip to content
Snippets Groups Projects
Commit 2b40fbd6 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[models.transforms] Fix qa

parent d2d83ca3
No related branches found
No related tags found
1 merge request!16Make square centre-padding a model transform
Pipeline #84056 failed
...@@ -10,7 +10,7 @@ import torchvision.transforms.functional ...@@ -10,7 +10,7 @@ import torchvision.transforms.functional
def square_center_pad(img: torch.Tensor) -> torch.Tensor: def square_center_pad(img: torch.Tensor) -> torch.Tensor:
"""Returns a squared version of the image, centered on a canvas padded with """Return a squared version of the image, centered on a canvas padded with
zeros. zeros.
Parameters Parameters
...@@ -23,8 +23,7 @@ def square_center_pad(img: torch.Tensor) -> torch.Tensor: ...@@ -23,8 +23,7 @@ def square_center_pad(img: torch.Tensor) -> torch.Tensor:
Returns Returns
------- -------
img Transformed tensor, guaranteed to be square (ie. equal height and
transformed tensor, guaranteed to be square (ie. equal height and
width). width).
""" """
...@@ -129,8 +128,7 @@ def rgb_to_grayscale(img: torch.Tensor) -> torch.Tensor: ...@@ -129,8 +128,7 @@ def rgb_to_grayscale(img: torch.Tensor) -> torch.Tensor:
class SquareCenterPad(torch.nn.Module): class SquareCenterPad(torch.nn.Module):
"""Transforms to a squared version of the image, centered on a canvas """Transform to a squared version of the image, centered on a canvas padded with zeros."""
padded with zeros."""
def __init__(self): def __init__(self):
super().__init__() super().__init__()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment