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)
| 2119 | return self |
| 2120 | |
| 2121 | def __call__(self, data: Mapping[Hashable, torch.Tensor], lazy: bool | None = None) -> dict[Hashable, torch.Tensor]: |
| 2122 | """ |
| 2123 | Args: |
| 2124 | data: a dictionary containing the tensor-like data to be processed. The ``keys`` specified |
| 2125 | in this dictionary must be tensor like arrays that are channel first and have at most |
| 2126 | three spatial dimensions |
| 2127 | lazy: a flag to indicate whether this transform should execute lazily or not |
| 2128 | during this call. Setting this to False or True overrides the ``lazy`` flag set |
| 2129 | during initialization for this call. Defaults to None. |
| 2130 | |
| 2131 | Returns: |
| 2132 | a dictionary containing the transformed data, as well as any other data present in the dictionary |
| 2133 | """ |
| 2134 | d = dict(data) |
| 2135 | first_key: Hashable = self.first_key(d) |
| 2136 | if first_key == (): |
| 2137 | out: dict[Hashable, torch.Tensor] = convert_to_tensor(d, track_meta=get_track_meta()) |
| 2138 | return out |
| 2139 | |
| 2140 | self.randomize(None) |
| 2141 | |
| 2142 | # all the keys share the same random zoom factor |
| 2143 | self.rand_zoom.randomize(d[first_key]) |
| 2144 | lazy_ = self.lazy if lazy is None else lazy |
| 2145 | |
| 2146 | for key, mode, padding_mode, align_corners, dtype in self.key_iterator( |
| 2147 | d, self.mode, self.padding_mode, self.align_corners, self.dtype |
| 2148 | ): |
| 2149 | if self._do_transform: |
| 2150 | d[key] = self.rand_zoom( |
| 2151 | d[key], |
| 2152 | mode=mode, |
| 2153 | padding_mode=padding_mode, |
| 2154 | align_corners=align_corners, |
| 2155 | dtype=dtype, |
| 2156 | randomize=False, |
| 2157 | lazy=lazy_, |
| 2158 | ) |
| 2159 | else: |
| 2160 | d[key] = convert_to_tensor(d[key], track_meta=get_track_meta(), dtype=torch.float32) |
| 2161 | self.push_transform(d[key], replace=True, lazy=lazy_) |
| 2162 | return d |
| 2163 | |
| 2164 | def inverse(self, data: Mapping[Hashable, torch.Tensor]) -> dict[Hashable, torch.Tensor]: |
| 2165 | d = dict(data) |
nothing calls this directly
no test coverage detected