Args: spatial_size: spatial size of the grid.
(self, spatial_size: Sequence[int])
| 1991 | self.rand_mag = self.R.uniform(self.magnitude[0], self.magnitude[1]) |
| 1992 | |
| 1993 | def __call__(self, spatial_size: Sequence[int]) -> torch.Tensor: |
| 1994 | """ |
| 1995 | Args: |
| 1996 | spatial_size: spatial size of the grid. |
| 1997 | """ |
| 1998 | self.spacing = fall_back_tuple(self.spacing, (1.0,) * len(spatial_size)) |
| 1999 | control_grid = create_control_grid(spatial_size, self.spacing, device=self.device, backend="torch") |
| 2000 | self.randomize(control_grid.shape[1:]) |
| 2001 | _offset, *_ = convert_to_dst_type(self.rand_mag * self.random_offset, control_grid) |
| 2002 | control_grid[: len(spatial_size)] += _offset |
| 2003 | return control_grid # type: ignore |
| 2004 | |
| 2005 | |
| 2006 | class Resample(Transform): |
nothing calls this directly
no test coverage detected