Skip to content

Conversation

@drivanov
Copy link
Contributor

@drivanov drivanov commented Nov 15, 2025

The test_to_hetero_lazy_cuda occasionally triggers the following warning:

 /usr/local/lib/python3.12/dist-packages/torch_geometric/nn/to_hetero_transformer.py:151: UserWarning: There exist node types ({'v0'}) whose representations do not get updated during message passing as they do not occur as destination type in any edge type. This may lead to unexpected behavior. 

This warning can nondeterministically escalate into an AttributeError, causing the test to fail:

====================== FAILURES ====================== ________________ test_to_hetero_lazy_cuda _________________ @onlyCUDA def test_to_hetero_lazy_cuda(): class Model(torch.nn.Module): def __init__(self): super().__init__() self.conv = GATv2Conv( (-1, -1), out_channels=2, add_self_loops=False, edge_dim=-1, heads=1, ).to('cuda') def forward(self, x, edge_index, edge_attr): return self.conv(x, edge_index, edge_attr) data = FakeHeteroDataset(edge_dim=10)[0].to('cuda') model = to_hetero(Model(), data.metadata()) out_dict = model(data.x_dict, data.edge_index_dict, data.edge_attr_dict) assert len(out_dict) == len(data.node_types) for out in out_dict.values(): > assert out.is_cuda E AttributeError: 'NoneType' object has no attribute 'is_cuda' test/nn/test_to_hetero_transformer.py:564: AttributeError 

The root cause is that the synthetic FakeHeteroDataset includes a node type (v0) that never appears as a destination in any edge type, so its representation is never updated. This fix ensures that all node types participate as destinations (via self-loop edges), preventing the warning and stabilizing the test.

Solution originated from ChatGPT guidance.

@codecov
Copy link

codecov bot commented Nov 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.09%. Comparing base (c211214) to head (2cecdfd).
⚠️ Report is 142 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@ ## master #10531 +/- ## ========================================== - Coverage 86.11% 85.09% -1.02%  ========================================== Files 496 510 +14 Lines 33655 35962 +2307 ========================================== + Hits 28981 30602 +1621  - Misses 4674 5360 +686 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant