Skip to content

aminmax will trigger INTERNAL ASSERT if input is empty on cuda #85439

@payphon

Description

@payphon

🐛 Describe the bug

aminmax will trigger INTERNAL ASSERT if input is empty on cuda

import torch

def fn(input):
    return input.aminmax(dim=0)

device = "cuda"

input = torch.empty([36, 0], dtype=torch.float32)
input.uniform_(-16, 3)

fn(input.to(device))
# RuntimeError: iter.numel() > 0 && iter.ntensors() - iter.noutputs() == 1 && iter.noutputs() >= 1 INTERNAL ASSERT FAILED at "/opt/conda/conda-bld/pytorch_1663571524876/work/aten/src/ATen/native/cuda/Reduce.cuh":1134, please report a bug to PyTorch.

On cpu, it will just return empty tensor

Versions

torch: '1.13.0.dev20220919'

cc @pbelevich

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionablegood first issuemodule: edge casesAdversarial inputs unlikely to occur in practicetriagedThis 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