Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I use the NeighborLoader object, it appears RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'. #9771

Open
zhangzhangzhanghui opened this issue Nov 10, 2024 · 0 comments
Labels

Comments

@zhangzhangzhanghui
Copy link

🐛 Describe the bug

from torch_geometric.datasets import Planetoid
from torch_geometric.loader import NeighborLoader

data = Planetoid('./', name='Cora')[0]

loader = NeighborLoader(
data,
# Sample 30 neighbors for each node for 2 iterations
num_neighbors=[30] * 2,
# Use a batch size of 128 for sampling training nodes
batch_size=128,
input_nodes=data.train_mask,
)

sampled_data = next(iter(loader))
print(sampled_data.batch_size)
This is an example code about the NeighborLoader class in the Pyg documentation.But when I run this code, I encounter the error mentioned in the title
RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
Position: 7
Value: True
Declaration: pyg::neighbor_sample(Tensor rowptr, Tensor col, Tensor seed, int[] num_neighbors, Tensor? node_time=None, Tensor? edge_time=None, Tensor? seed_time=None, Tensor? edge_weight=None, bool csc=False, bool replace=False, bool directed=True, bool disjoint=False, str temporal_strategy="uniform", bool return_edge_id=True) -> (Tensor, Tensor, Tensor, Tensor?, int[], int[])
Cast error details: Unable to cast True to Tenso

And in my heterogeneous graph experiment, the loader that builds heterogeneous graphs will appear
pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'
But during the debugging process, I was able to find that the edge_ceight of node_stample in the loader object is None

Versions

PyTorch version: 2.4.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 11 专业版 (10.0.22631 64 位)
GCC version: (Rev2, Built by MSYS2 project) 13.2.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: N/A

Python version: 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:34:57) [MSC v.1936 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.22621-SP0
Is CUDA available: True
CUDA runtime version: 12.2.91
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3090
Nvidia driver version: 560.94
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Name: Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
Manufacturer: GenuineIntel
Family: 207
Architecture: 9
ProcessorType: 3
DeviceID: CPU0
CurrentClockSpeed: 3601
MaxClockSpeed: 3601
L2CacheSize: 2560
L2CacheSpeed: None
Revision: None

Versions of relevant libraries:
[pip3] easy-torch==1.3.2
[pip3] numpy==1.22.4
[pip3] onnxruntime==1.19.2
[pip3] pytorch-transformers==1.2.0
[pip3] torch==2.4.0+cu121
[pip3] torch_cluster==1.6.3+pt24cu121
[pip3] torch_geometric==2.4.0
[pip3] torch_scatter==2.1.2+pt24cu121
[pip3] torch_sparse==0.6.18+pt24cu121
[pip3] torch_spline_conv==1.2.2+pt24cu121
[pip3] torchaudio==2.4.0+cu121
[pip3] torchinfo==1.8.0
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.19.0+cu121
[conda] blas 1.0 mkl https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
[conda] easy-torch 1.3.2 pypi_0 pypi
[conda] mkl 2023.1.0 h6b88ed4_46358 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
[conda] mkl-service 2.4.0 py310h2bbff1b_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
[conda] mkl_fft 1.3.10 py310h827c3e9_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
[conda] mkl_random 1.2.7 py310hc64d2fc_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
[conda] numpy 1.22.4 pypi_0 pypi
[conda] pytorch-mutex 1.0 cpu https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
[conda] pytorch-transformers 1.2.0 pypi_0 pypi
[conda] torch 2.4.0+cu121 pypi_0 pypi
[conda] torch-cluster 1.6.3+pt24cu121 pypi_0 pypi
[conda] torch-geometric 2.4.0 pypi_0 pypi
[conda] torch-scatter 2.1.2+pt24cu121 pypi_0 pypi
[conda] torch-sparse 0.6.18+pt24cu121 pypi_0 pypi
[conda] torch-spline-conv 1.2.2+pt24cu121 pypi_0 pypi
[conda] torchaudio 2.4.0+cu121 pypi_0 pypi
[conda] torchinfo 1.8.0 pypi_0 pypi
[conda] torchsummary 1.5.1 pypi_0 pypi
[conda] torchvision 0.19.0+cu121 pypi_0 pypi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant