Description
Currently helpers like _supported_float_type and the utilities convert_to_float and img_as_float convert any integer type to float64.
Now that we have single precision support almost everywhere, I think it makes sense to convert bool, uint8, uint16, int8 and int16 to float32 instead. This would reduce memory overhead and should have some performance benefit (there is a particularly large benefit to float32 vs float64 for GPU-based backends). For example, uint8 is very common and casting that to float64 is an 8x memory overhead.
float32 cannot exactly represent the full range for 32-bit or larger integer types, so those would continue to promote to float64.
I am +1 on such a change (to be introduced with skimage2). Are there any strong reasons not to do this?
Description
Currently helpers like
_supported_float_typeand the utilitiesconvert_to_floatandimg_as_floatconvert any integer type tofloat64.Now that we have single precision support almost everywhere, I think it makes sense to convert
bool,uint8,uint16,int8andint16tofloat32instead. This would reduce memory overhead and should have some performance benefit (there is a particularly large benefit to float32 vs float64 for GPU-based backends). For example,uint8is very common and casting that tofloat64is an 8x memory overhead.float32cannot exactly represent the full range for 32-bit or larger integer types, so those would continue to promote tofloat64.I am +1 on such a change (to be introduced with
skimage2). Are there any strong reasons not to do this?