Skip to content

generalized_box_iou_loss input checks raise on nan values #5322

@nlgranger

Description

@nlgranger

🐛 Describe the bug

The assert:

assert (x2 >= x1).all(), "bad box: x1 larger than x2"
assert (y2 >= y1).all(), "bad box: y1 larger than y2"

crashes on nan inputs instead of just forwarding the nan values to the output.

It can be resolved by using this test instead:

    assert not (x2 < x1).any(), "bad box: x1 larger than x2"
    assert not (y2 < y1).any(), "bad box: y1 larger than y2"

Not sure there should be any tests at all though. It costs a GPU->CPU synchronization.

Versions

PyTorch version: 1.11.0.dev20220131
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Arch Linux (x86_64)
GCC version: (GCC) 11.1.0
Clang version: 13.0.0
CMake version: version 3.22.2
Libc version: glibc-2.33

Python version: 3.9.7 (default, Sep 16 2021, 13:09:58) [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.15.17-1-lts-x86_64-with-glibc2.33
Is CUDA available: True
CUDA runtime version: 11.3.109
GPU models and configuration: GPU 0: Quadro T1000
Nvidia driver version: 495.46
cuDNN version: Probably one of the following:
/opt/cuda-11.3/targets/x86_64-linux/lib/libcudnn.so.8.2.0
/opt/cuda-11.3/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.2.0
/opt/cuda-11.3/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.2.0
/opt/cuda-11.3/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.2.0
/opt/cuda-11.3/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.2.0
/opt/cuda-11.3/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.2.0
/opt/cuda-11.3/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.2.0
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.21.2
[pip3] torch==1.11.0.dev20220131
[pip3] torchvision==0.12.0.dev20220131
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] mkl 2021.4.0 h06a4308_640
[conda] mkl-service 2.4.0 py39h7f8727e_0
[conda] mkl_fft 1.3.1 py39hd3c417c_0
[conda] mkl_random 1.2.2 py39h51133e4_0
[conda] numpy 1.21.2 py39h20f2e39_0
[conda] numpy-base 1.21.2 py39h79a1101_0
[conda] pytorch 1.11.0.dev20220131 py3.9_cuda11.3_cudnn8.2.0_0 pytorch-nightly
[conda] pytorch-mutex 1.0 cuda pytorch-nightly
[conda] torchvision 0.12.0.dev20220131 py39_cu113 pytorch-nightly

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions