Skip to content

Conv2d crashes with stride=0 #27598

@jatentaki

Description

@jatentaki

🐛 Bug

As in the title: sanitization for the stride argument to convolutions doesn't check for 0 and crashes with core dump (note that negative strides are checked).

To Reproduce

input = torch.randn(1, 1, 32, 32)
c = nn.Conv2d(1, 32, 3, stride=0, bias=False, padding=(0, 1), padding_mode='constant')
c(input)

Expected behavior

A Python exception, ideally at Conv2d instantiation; alternatively at call site.

Environment

PyTorch version: 1.2.0
Is debug build: No
CUDA used to build PyTorch: None

OS: Ubuntu 18.04.3 LTS
GCC version: (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
CMake version: version 3.10.2

Python version: 3.7
Is CUDA available: No
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA

Versions of relevant libraries:
[pip] Could not collect
[conda] cpuonly 1.0 0 pytorch
[conda] pytorch 1.2.0 py3.7_cpu_0 [cpuonly] pytorch
[conda] torchvision 0.4.0 py37_cpu [cpuonly] pytorch

cc @ezyang @gchanan @zou3519

Metadata

Metadata

Assignees

Labels

high prioritymodule: crashProblem manifests as a hard crash, as opposed to a RuntimeErrormodule: error checkingBugs related to incorrect/lacking error checkingmodule: nnRelated to torch.nntriagedThis 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