Summary
When nn.MaxUnpool2d is called with invalid indices (e.g., all values set to -1), OneFlow does not raise a Python error. Instead, the process aborts due to a C++ CHECKfailure.
Code to reproduce bug
import oneflow as flow
import oneflow.nn as nn
import numpy as np
device = "cpu"
flow.manual_seed(0)
np.random.seed(0)
class M(nn.Module):
    def __init__(self):
        super().__init__()
        self.unpool = nn.MaxUnpool2d(kernel_size=2)
    def forward(self, x, indices):
        return self.unpool(x, indices)
def main():
    m = M().to(device)
    x = flow.tensor(np.random.rand(1, 1, 2, 2), dtype=flow.float32, device=device)
    # Invalid indices: all set to -1
    bad_idx = flow.full_like(x.to(flow.int64), -1)
    print("about to call unpool with invalid indices = -1")
    y = m(x, bad_idx)
    # Force sync to trigger backend error
    print("forcing sync via .numpy() ...")
    _ = y.numpy()
if __name__ == "__main__":
    main() 
System Information
- OS: Ubuntu 22.04.4 LTS (x86_64)
 
- OneFlow version : 1.0.0.dev20250921+cpu
 
- Python version: 3.10.16