🐛 Bug
Wrapping a rfloordiv operation with torch.jit.script somehow swallows the warning:
To Reproduce
# Run with python -Walways
import torch
def wrap_div(a):
return 5 // a
script_wrap_div = torch.jit.script(wrap_div)
a = torch.tensor(5, dtype=int)
print('This does not warn')
script_wrap_div(a)
print('This warns')
wrap_div(a)
will print
$ python -Walways /tmp/stam.py
This does not warn
This warns
pytorch/torch/tensor.py:563: UserWarning: floor_divide is deprecated, and will be removed in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values.
To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor'). (Triggered internally at ../aten/src/ATen/native/BinaryOps.cpp:335.)
return torch.floor_divide(other, self)
Expected behavior
Between the This does not warn and the This warns lines, I expected to see the warning
Environment
PyTorch version: 1.9.0a0+8b0ca1a
Is debug build: True
CUDA used to build PyTorch: 11.2
ROCM used to build PyTorch: N/A
OS: Ubuntu 20.04.2 LTS (x86_64)
GCC version: (crosstool-NG 1.24.0.133_b0863d8_dirty) 9.3.0
Clang version: 11.0.1 (https://github.com/conda-forge/clangdev-feedstock 9fbb64b62ff49e9d206a06e62453b27557b3ed73)
CMake version: version 3.19.4
Python version: 3.7 (64-bit runtime)
Is CUDA available: True
CUDA runtime version: 11.2.142
GPU models and configuration: GPU 0: GeForce GTX 1660 SUPER
Nvidia driver version: 460.32.03
cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.5
HIP runtime version: N/A
MIOpen runtime version: N/A
Versions of relevant libraries:
[pip] numpy==1.20.0
[pip] pytorch-sphinx-theme==0.0.24
[pip] torch==1.9.0a0+8b0ca1a
[conda] cudatoolkit 11.2.0 h73cb219_7 conda-forge
[conda] magma-cuda112 2.5.2 1 pytorch
[conda] mkl 2020.4 h726a3e6_304 conda-forge
[conda] mkl-include 2020.4 h726a3e6_304 conda-forge
[conda] numpy 1.20.0 py37haa41c4c_0 conda-forge
[conda] pytorch-sphinx-theme 0.0.24 dev_0
[conda] torch 1.9.0a0+8b0ca1a dev_0
Additional context
Discovered when working on PR gh-52387, part of issue gh-50006
cc @gmagogsfm
🐛 Bug
Wrapping a rfloordiv operation with
torch.jit.scriptsomehow swallows the warning:To Reproduce
will print
Expected behavior
Between the
This does not warnand theThis warnslines, I expected to see the warningEnvironment
PyTorch version: 1.9.0a0+8b0ca1a
Is debug build: True
CUDA used to build PyTorch: 11.2
ROCM used to build PyTorch: N/A
OS: Ubuntu 20.04.2 LTS (x86_64)
GCC version: (crosstool-NG 1.24.0.133_b0863d8_dirty) 9.3.0
Clang version: 11.0.1 (https://github.com/conda-forge/clangdev-feedstock 9fbb64b62ff49e9d206a06e62453b27557b3ed73)
CMake version: version 3.19.4
Python version: 3.7 (64-bit runtime)
Is CUDA available: True
CUDA runtime version: 11.2.142
GPU models and configuration: GPU 0: GeForce GTX 1660 SUPER
Nvidia driver version: 460.32.03
cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.5
HIP runtime version: N/A
MIOpen runtime version: N/A
Versions of relevant libraries:
[pip] numpy==1.20.0
[pip] pytorch-sphinx-theme==0.0.24
[pip] torch==1.9.0a0+8b0ca1a
[conda] cudatoolkit 11.2.0 h73cb219_7 conda-forge
[conda] magma-cuda112 2.5.2 1 pytorch
[conda] mkl 2020.4 h726a3e6_304 conda-forge
[conda] mkl-include 2020.4 h726a3e6_304 conda-forge
[conda] numpy 1.20.0 py37haa41c4c_0 conda-forge
[conda] pytorch-sphinx-theme 0.0.24 dev_0
[conda] torch 1.9.0a0+8b0ca1a dev_0
Additional context
Discovered when working on PR gh-52387, part of issue gh-50006
cc @gmagogsfm