Args: data: a dictionary containing the tensor-like data to be processed. The ``keys`` specified in this dictionary must be tensor like arrays that are channel first and have at most three spatial dimensions lazy: a flag to indicate wh
(self, data: Mapping[Hashable, torch.Tensor], lazy: bool | None = None)
| 1891 | return self |
| 1892 | |
| 1893 | def __call__(self, data: Mapping[Hashable, torch.Tensor], lazy: bool | None = None) -> dict[Hashable, torch.Tensor]: |
| 1894 | """ |
| 1895 | Args: |
| 1896 | data: a dictionary containing the tensor-like data to be processed. The ``keys`` specified |
| 1897 | in this dictionary must be tensor like arrays that are channel first and have at most |
| 1898 | three spatial dimensions |
| 1899 | lazy: a flag to indicate whether this transform should execute lazily or not |
| 1900 | during this call. Setting this to False or True overrides the ``lazy`` flag set |
| 1901 | during initialization for this call. Defaults to None. |
| 1902 | |
| 1903 | Returns: |
| 1904 | a dictionary containing the transformed data, as well as any other data present in the dictionary |
| 1905 | """ |
| 1906 | d = dict(data) |
| 1907 | self.randomize(None) |
| 1908 | |
| 1909 | # all the keys share the same random rotate angle |
| 1910 | self.rand_rotate.randomize() |
| 1911 | lazy_ = self.lazy if lazy is None else lazy |
| 1912 | |
| 1913 | for key, mode, padding_mode, align_corners, dtype in self.key_iterator( |
| 1914 | d, self.mode, self.padding_mode, self.align_corners, self.dtype |
| 1915 | ): |
| 1916 | if self._do_transform: |
| 1917 | d[key] = self.rand_rotate( |
| 1918 | d[key], |
| 1919 | mode=mode, |
| 1920 | padding_mode=padding_mode, |
| 1921 | align_corners=align_corners, |
| 1922 | dtype=dtype, |
| 1923 | randomize=False, |
| 1924 | lazy=lazy_, |
| 1925 | ) |
| 1926 | else: |
| 1927 | d[key] = convert_to_tensor(d[key], track_meta=get_track_meta(), dtype=torch.float32) |
| 1928 | self.push_transform(d[key], replace=True, lazy=lazy_) |
| 1929 | return d |
| 1930 | |
| 1931 | def inverse(self, data: Mapping[Hashable, torch.Tensor]) -> dict[Hashable, torch.Tensor]: |
| 1932 | d = dict(data) |
nothing calls this directly
no test coverage detected