Skip to content

Unexpected numeric limit for CUDA integral types #19673

@LeviViana

Description

@LeviViana

To Reproduce

import torch
x = torch.ones(0).cuda()
print(x.float().max().item()) # -inf
print(x.int().max().item()) # 0

Expected behavior

print(x.int().max().item()) should output the lowest numeric limit for the integer type.

Note

The same issue arises for all integral types: byte, short, int and long.
Related to #19612.

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: cudaRelated to torch.cuda, and CUDA support in generaltriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions