Set the `spatial_size` and `spatial_zoom` attributes used for interpolating the field to the given dimension, or not interpolate at all if None. Args: spatial_size: new size to interpolate to, or None to not interpolate
(self, spatial_size: Sequence[int] | None)
| 99 | self.field[self.rand_slices] = torch.from_numpy(self.R.uniform(self.low, self.high, self.crand_size)) # type: ignore[index] |
| 100 | |
| 101 | def set_spatial_size(self, spatial_size: Sequence[int] | None) -> None: |
| 102 | """ |
| 103 | Set the `spatial_size` and `spatial_zoom` attributes used for interpolating the field to the given |
| 104 | dimension, or not interpolate at all if None. |
| 105 | |
| 106 | Args: |
| 107 | spatial_size: new size to interpolate to, or None to not interpolate |
| 108 | """ |
| 109 | if spatial_size is None: |
| 110 | self.spatial_size = None |
| 111 | self.spatial_zoom = None |
| 112 | else: |
| 113 | self.spatial_size = tuple(spatial_size) |
| 114 | self.spatial_zoom = tuple(s / f for s, f in zip(self.spatial_size, self.total_rand_size)) |
| 115 | |
| 116 | def set_mode(self, mode: str) -> None: |
| 117 | self.mode = mode |