adaptive_max_pool2d int64: eager raises but `torch.compile` (inductor) silently accepts
Describe the bug
torch.nn.functional.adaptive_max_pool2d on an int64 input raises in eager but is
silently accepted under torch.compile (inductor) — so a program that errors in eager
starts "working" (and returns an int64 result) once compiled.
eager: NotImplementedError: "adaptive_max_pool2d" not implemented for 'Long'
compiled: tensor([[[[5]]]], dtype=torch.int64) # inductor accepts and computes
Minimal repro
import torch
import torch.nn.functional as F
def fn(x):
return F.adaptive_max_pool2d(x, (1, 1))
x = torch.randint(0, 10, (1, 1, 2, 2), dtype=torch.int64)
fn(x) # eager: NotImplementedError ("... for 'Long'")
torch.compile(fn, backend="inductor")(x) # compiled: OK -> tensor([[[[5]]]], dtype=int64)
# a supported dtype is consistent (control):
xf = torch.randn(1, 1, 2, 2)
assert torch.equal(fn(xf), torch.compile(fn, backend="inductor")(xf)) # eager == compiled
Expected behavior
Eager and compiled should agree on whether an int64 input is supported: either both accept it, or both reject it. A program must not error in eager yet silently succeed when compiled.
Actual behavior
Eager raises NotImplementedError for the Long dtype; inductor's decomposition handles
int64 and returns the max. So the two paths disagree for int64 (they agree for float).
Versions
PyTorch version: 2.15.0a0+gite67e43b
Is debug build: True
CUDA used to build PyTorch: 12.6
ROCM used to build PyTorch: N/A
OS: Ubuntu 22.04.4 LTS (x86_64)
GCC version: (Ubuntu 12.3.0-1ubuntu1~22.04.3) 12.3.0
Clang version: 17.0.6
CMake version: version 4.0.0
Libc version: glibc-2.35
Python version: 3.12.13 | packaged by conda-forge (64-bit runtime)
Python platform: Linux-6.8.0-138-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.6.20
GPU 0: NVIDIA RTX A6000
Nvidia driver version: 580.82.07
cuDNN version: 9.3.0
[pip3] numpy==2.3.5
[pip3] torch==2.15.0a0+gite67e43b
[pip3] triton==3.7.1
cc @mikaylagawarecki @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @aakhundov @coconutruben @jataylo
Source: pytorch/pytorch