ToDtype¶
- class torchaug.transforms.ToDtype(dtype, scale=False)[source]¶
Converts the input to a specific dtype, optionally scaling the values for images or videos.
Note
ToDtype(dtype, scale=True)is the recommended replacement forConvertImageDtype(dtype).- Parameters:
dtype (
Union[dtype,Dict[Union[Type,str],Optional[dtype]]]) – The dtype to convert to. If atorch.dtypeis passed, e.g.torch.float32, only images and videos will be converted to that dtype: this is for compatibility withtorchvision.transforms.v2.ConvertImageDtype. A dict can be passed to specify per-ta_tensor conversions, e.g.dtype={ta_tensors.Image: torch.float32, ta_tensors.Mask: torch.int64, "others":None}. The “others” key can be used as a catch-all for any other ta_tensor type, andNonemeans no conversion.scale (
bool, optional) – Whether to scale the values for images or videos. Default:False