Compute the target spatial size which should be divisible by `k`. Args: spatial_shape: original spatial shape. k: the target k for each spatial dimension. if `k` is negative or 0, the original size is preserved. if `k` is an int, the same `k` be appl
(spatial_shape: Sequence[int], k: Sequence[int] | int)
| 1818 | |
| 1819 | |
| 1820 | def compute_divisible_spatial_size(spatial_shape: Sequence[int], k: Sequence[int] | int): |
| 1821 | """ |
| 1822 | Compute the target spatial size which should be divisible by `k`. |
| 1823 | |
| 1824 | Args: |
| 1825 | spatial_shape: original spatial shape. |
| 1826 | k: the target k for each spatial dimension. |
| 1827 | if `k` is negative or 0, the original size is preserved. |
| 1828 | if `k` is an int, the same `k` be applied to all the input spatial dimensions. |
| 1829 | |
| 1830 | """ |
| 1831 | k = fall_back_tuple(k, (1,) * len(spatial_shape)) |
| 1832 | new_size = [] |
| 1833 | for k_d, dim in zip(k, spatial_shape): |
| 1834 | new_dim = int(np.ceil(dim / k_d) * k_d) if k_d > 0 else dim |
| 1835 | new_size.append(new_dim) |
| 1836 | |
| 1837 | return tuple(new_size) |
| 1838 | |
| 1839 | |
| 1840 | def equalize_hist( |
no test coverage detected
searching dependent graphs…