Args: img: channel first array, must have shape: (num_channels, H[, W, ..., ]), randomize: whether to execute `randomize()` function first, default to True. lazy: a flag to indicate whether this transform should execute lazily or not durin
(self, img: torch.Tensor, randomize: bool = True, lazy: bool | None = None)
| 1271 | self._rand_k = self.R.randint(self.max_k) + 1 |
| 1272 | |
| 1273 | def __call__(self, img: torch.Tensor, randomize: bool = True, lazy: bool | None = None) -> torch.Tensor: |
| 1274 | """ |
| 1275 | Args: |
| 1276 | img: channel first array, must have shape: (num_channels, H[, W, ..., ]), |
| 1277 | randomize: whether to execute `randomize()` function first, default to True. |
| 1278 | lazy: a flag to indicate whether this transform should execute lazily or not |
| 1279 | during this call. Setting this to False or True overrides the ``lazy`` flag set |
| 1280 | during initialization for this call. Defaults to None. |
| 1281 | """ |
| 1282 | |
| 1283 | if randomize: |
| 1284 | self.randomize() |
| 1285 | |
| 1286 | lazy_ = self.lazy if lazy is None else lazy |
| 1287 | if self._do_transform: |
| 1288 | xform = Rotate90(self._rand_k, self.spatial_axes, lazy=lazy_) |
| 1289 | out = xform(img) |
| 1290 | else: |
| 1291 | out = convert_to_tensor(img, track_meta=get_track_meta()) |
| 1292 | |
| 1293 | self.push_transform(out, replace=True, lazy=lazy_) |
| 1294 | return out |
| 1295 | |
| 1296 | def inverse(self, data: torch.Tensor) -> torch.Tensor: |
| 1297 | xform_info = self.pop_transform(data) |
nothing calls this directly
no test coverage detected