Skip to content

LinkPredNDCG does not cast discount to device #10518

@maxvbb

Description

@maxvbb

🐛 Describe the bug

LinkPredNDCG (https://pytorch-geometric.readthedocs.io/en/latest/_modules/torch_geometric/metrics/link_pred.html#LinkPredNDCG) does not cast discount to the same device as pred_rel_mat resulting in errors if pred_index_mat is on another device.

However, not sure if this is intended for some reason.

Versions

Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: macOS 26.0.1 (arm64)
GCC version: Could not collect
Clang version: 17.0.0 (clang-1700.3.19.1)
CMake version: version 4.1.0
Libc version: N/A

Python version: 3.14.0 (main, Oct 7 2025, 09:34:52) [Clang 17.0.0 (clang-1700.3.19.1)] (64-bit runtime)
Python platform: macOS-26.0.1-arm64-arm-64bit-Mach-O
Is CUDA available: N/A
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
Is XPU available: N/A
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

CPU:
Apple M4 Max

Versions of relevant libraries:
[pip3] No relevant packages
[conda] numpy 2.3.4 pypi_0 pypi
[conda] torch 2.9.0 pypi_0 pypi
[conda] torch-geometric 2.7.0 pypi_0 pypi
[conda] torchvision 0.24.0 pypi_0 pypi

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions