Skip to content

No guard against empty tensors for nn.functional.dropout() #20499

@fuzic

Description

@fuzic

🐛 Bug

python crashes (with SIGFPE) when dropout is called on an empty cuda tensor.

To Reproduce

Steps to reproduce the behavior:

import torch
torch.nn.functional.dropout(torch.Tensor([]).to('cuda'))
Floating point exception (core dumped)

Expected behavior

Either a python exception should be raised or it should be a no-op.

Environment

  • PyTorch Version (e.g., 1.0): master
  • OS (e.g., Linux): centos
  • How you installed PyTorch (conda, pip, source): source
  • Build command you used (if compiling from source):
  • Python version: 3.6
  • CUDA/cuDNN version: cuda 9.2
  • GPU models and configuration:
  • Any other relevant information:

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions