Skip to content

Commit d0583f6

Browse files
wesleylpEduardoPach
authored andcommitted
Fix docstring get maskformer resize output image size (huggingface#27196)
* fix docstring in get_maskformer_resize_output_image_size * fix functions docstring * fix 'copied from' functions docstring * fix docstring * fix return type * fix docstring resize
1 parent 5ec6ab5 commit d0583f6

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

src/transformers/models/mask2former/image_processing_mask2former.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -304,21 +304,23 @@ def get_mask2former_resize_output_image_size(
304304
size_divisor: int = 0,
305305
default_to_square: bool = True,
306306
input_data_format: Optional[Union[str, ChannelDimension]] = None,
307-
) -> tuple:
307+
) -> Tuple[int, int]:
308308
"""
309309
Computes the output size given the desired size.
310310
311311
Args:
312-
input_image (`np.ndarray`):
312+
image (`np.ndarray`):
313313
The input image.
314-
size (`int`, `Tuple[int, int]`, `List[int]`, `Tuple[int]`):
314+
size (`int` or `Tuple[int, int]` or `List[int]` or `Tuple[int]`):
315315
The size of the output image.
316-
default_to_square (`bool`, *optional*, defaults to `True`):
317-
Whether to default to square if no size is provided.
318316
max_size (`int`, *optional*):
319317
The maximum size of the output image.
320-
size_divisible (`int`, *optional*, defaults to 0):
321-
If size_divisible is given, the output image size will be divisible by the number.
318+
size_divisor (`int`, *optional*, defaults to 0):
319+
If `size_divisor` is given, the output image size will be divisible by the number.
320+
default_to_square (`bool`, *optional*, defaults to `True`):
321+
Whether to default to square if no size is provided.
322+
input_data_format (`ChannelDimension` or `str`, *optional*):
323+
The channel dimension format of the input image. If unset, will use the inferred format from the input.
322324
323325
Returns:
324326
`Tuple[int, int]`: The output size.
@@ -471,10 +473,10 @@ def resize(
471473
size (`Dict[str, int]`):
472474
The size of the output image.
473475
size_divisor (`int`, *optional*, defaults to 0):
474-
If size_divisor is given, the output image size will be divisible by the number.
476+
If `size_divisor` is given, the output image size will be divisible by the number.
475477
resample (`PILImageResampling` resampling filter, *optional*, defaults to `PILImageResampling.BILINEAR`):
476478
Resampling filter to use when resizing the image.
477-
data_format (`str` or `ChannelDimension`, *optional*):
479+
data_format (`ChannelDimension` or `str`, *optional*):
478480
The channel dimension format for the output image. If unset, the channel dimension format of the input
479481
image is used.
480482
input_data_format (`ChannelDimension` or `str`, *optional*):

src/transformers/models/maskformer/image_processing_maskformer.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,21 +306,23 @@ def get_maskformer_resize_output_image_size(
306306
size_divisor: int = 0,
307307
default_to_square: bool = True,
308308
input_data_format: Optional[Union[str, ChannelDimension]] = None,
309-
) -> tuple:
309+
) -> Tuple[int, int]:
310310
"""
311311
Computes the output size given the desired size.
312312
313313
Args:
314-
input_image (`np.ndarray`):
314+
image (`np.ndarray`):
315315
The input image.
316-
size (`int`, `Tuple[int, int]`, `List[int]`, `Tuple[int]`):
316+
size (`int` or `Tuple[int, int]` or `List[int]` or `Tuple[int]`):
317317
The size of the output image.
318-
default_to_square (`bool`, *optional*, defaults to `True`):
319-
Whether to default to square if no size is provided.
320318
max_size (`int`, *optional*):
321319
The maximum size of the output image.
322-
size_divisible (`int`, *optional*, defaults to 0):
323-
If size_divisible is given, the output image size will be divisible by the number.
320+
size_divisor (`int`, *optional*, defaults to 0):
321+
If `size_divisor` is given, the output image size will be divisible by the number.
322+
default_to_square (`bool`, *optional*, defaults to `True`):
323+
Whether to default to square if no size is provided.
324+
input_data_format (`ChannelDimension` or `str`, *optional*):
325+
The channel dimension format of the input image. If unset, will use the inferred format from the input.
324326
325327
Returns:
326328
`Tuple[int, int]`: The output size.
@@ -479,10 +481,10 @@ def resize(
479481
size (`Dict[str, int]`):
480482
The size of the output image.
481483
size_divisor (`int`, *optional*, defaults to 0):
482-
If size_divisor is given, the output image size will be divisible by the number.
484+
If `size_divisor` is given, the output image size will be divisible by the number.
483485
resample (`PILImageResampling` resampling filter, *optional*, defaults to `PILImageResampling.BILINEAR`):
484486
Resampling filter to use when resizing the image.
485-
data_format (`str` or `ChannelDimension`, *optional*):
487+
data_format (`ChannelDimension` or `str`, *optional*):
486488
The channel dimension format for the output image. If unset, the channel dimension format of the input
487489
image is used.
488490
input_data_format (`ChannelDimension` or `str`, *optional*):

0 commit comments

Comments
 (0)