Skip to content

proposal: cast small integer types to single precision #6310

@grlee77

Description

@grlee77

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions