|
6 | 6 | irange = range
|
7 | 7 |
|
8 | 8 |
|
9 |
| -def make_grid(tensor: Union[torch.Tensor, Sequence[torch.Tensor]], nrow: int = 8, |
10 |
| - padding: int = 2, normalize: bool = False, |
11 |
| - range: Optional[Tuple[int, int]] = None, scale_each: bool = False, |
12 |
| - pad_value: int = 0) -> torch.Tensor: |
| 9 | +def make_grid( |
| 10 | + tensor: Union[torch.Tensor, Sequence[torch.Tensor]], |
| 11 | + nrow: int = 8, |
| 12 | + padding: int = 2, |
| 13 | + normalize: bool = False, |
| 14 | + range: Optional[Tuple[int, int]] = None, |
| 15 | + scale_each: bool = False, |
| 16 | + pad_value: int = 0, |
| 17 | +) -> torch.Tensor: |
13 | 18 | """Make a grid of images.
|
14 | 19 |
|
15 | 20 | Args:
|
@@ -93,9 +98,17 @@ def norm_range(t, range):
|
93 | 98 | return grid
|
94 | 99 |
|
95 | 100 |
|
96 |
| -def save_image(tensor: Union[torch.Tensor, Sequence[torch.Tensor]], fp: Union[Text, pathlib.Path, BinaryIO], |
97 |
| - nrow: int = 8, padding: int = 2, normalize: bool = False, range: Optional[Tuple[int, int]] = None, |
98 |
| - scale_each: bool = False, pad_value: int = 0, format: Optional[str] = None) -> None: |
| 101 | +def save_image( |
| 102 | + tensor: Union[torch.Tensor, Sequence[torch.Tensor]], |
| 103 | + fp: Union[Text, pathlib.Path, BinaryIO], |
| 104 | + nrow: int = 8, |
| 105 | + padding: int = 2, |
| 106 | + normalize: bool = False, |
| 107 | + range: Optional[Tuple[int, int]] = None, |
| 108 | + scale_each: bool = False, |
| 109 | + pad_value: int = 0, |
| 110 | + format: Optional[str] = None, |
| 111 | +) -> None: |
99 | 112 | """Save a given Tensor into an image file.
|
100 | 113 |
|
101 | 114 | Args:
|
|
0 commit comments