Convert a tensor image to the given dtype and scale the values accordingly

transform_convert_image_dtype(img, dtype = torch::torch_float())

Arguments

img

A magick-image, array or torch_tensor.

dtype

(torch.dtype): Desired data type of the output.

Note

When converting from a smaller to a larger integer dtype the maximum values are not mapped exactly. If converted back and forth, this mismatch has no effect.