-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Description
🐛 Describe the bug
import torch
input = torch.tensor([[1, 2], [3, 4]], dtype=torch.int)
indices = [torch.tensor([[True, False], [False, True]], dtype=torch.bool)]
# Both should return tensor [1, 4], but it seems index doesn't properly handle dtype conversions
print(torch.ops.aten.index.Tensor_out(input, indices, out=torch.tensor([0, 0], dtype=torch.int)))
print(torch.ops.aten.index.Tensor_out(input, indices, out=torch.tensor([0, 0], dtype=torch.long)))Result:
tensor([1, 4], dtype=torch.int32)
tensor([8589934593, 4])
Versions
Collecting environment information...
PyTorch version: 2.0.1
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 13.5 (arm64)
GCC version: Could not collect
Clang version: 14.0.0 (clang-1400.0.29.202)
CMake version: Could not collect
Libc version: N/A
Python version: 3.9.6 (default, Oct 18 2022, 12:41:40) [Clang 14.0.0 (clang-1400.0.29.202)] (64-bit runtime)
Python platform: macOS-13.5-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Apple M1 Pro
Versions of relevant libraries:
[pip3] numpy==1.24.3
[pip3] torch==2.0.1
[conda] Could not collect