Tensor size mismatch in usage of captum to explain graph - Chapter 14
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- jupyter-notebook, python
- Ambito
- machine-learning
Direzione di ricerca
The traceback points to the Chapter 14 notebook, the GCN.forward call in cell 87, and the custom GCNConv implementation in cell 11. Re-run the notebook and inspect the tensor shapes at the failing message-passing step. Done means the model's forward pass and loss calculation complete without the tensor-size mismatch.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I am receiving the following error:
RuntimeError: The size of tensor a (84900) must match the size of tensor b (7126) at non-singleton dimension 0
{
"name": "RuntimeError",
"message": "The size of tensor a (84900) must match the size of tensor b (7126) at non-singleton dimension 0",
"stack": "---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[87], line 21
19 model.train()
20 optimizer.zero_grad()
---> 21 log_logits = model(data.x, data.edge_index)
22 loss = F.nll_loss(log_logits, data.y)
23 loss.backward()
File ~/Desktop/Extras/Graph-Neural-Network/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py:1553, in Module._wrapped_call_impl(self, *args, **kwargs)
1551 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1552 else:
-> 1553 return self._call_impl(*args, **kwargs)
File ~/Desktop/Extras/Graph-Neural-Network/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py:1562, in Module._call_impl(self, *args, **kwargs)
1557 # If we don't have any hooks, we want to skip the rest of the logic in
1558 # this function, and just call forward.
1559 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1560 or _global_backward_pre_hooks or _global_backward_hooks
1561 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1562 return forward_call(*args, **kwargs)
1564 try:
1565 result = None
Cell In[87], line 8, in GCN.forward(self, x, edge_index)
7 def forward(self, x, edge_index):
----> 8 h = self.conv1(x, edge_index).relu()
9 h = F.dropout(h, p=0.5, training=self.training)
10 h = self.conv2(h, edge_index)
File ~/Desktop/Extras/Graph-Neural-Network/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py:1553, in Module._wrapped_call_impl(self, *args, **kwargs)
1551 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1552 else:
-> 1553 return self._call_impl(*args, **kwargs)
File ~/Desktop/Extras/Graph-Neural-Network/.venv/lib/python3.12/site-packages/torch/nn/modules/module.py:1562, in Module._call_impl(self, *args, **kwargs)
1557 # If we don't have any hooks, we want to skip the rest of the logic in
1558 # this function, and just call forward.
1559 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1560 or _global_backward_pre_hooks or _global_backward_hooks
1561 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1562 return forward_call(*args, **kwargs)
1564 try:
1565 result = None
Cell In[11], line 20, in GCNConv.forward(self, x, edge_index)
17 deg_inv_sqrt[deg_inv_sqrt == float('inf')] = 0
18 norm = deg_inv_sqrt[row] * deg_inv_sqrt[col]
---> 20 out = self.propagate(edge_index, x=x, norm=norm)
22 return out
File ~/Desktop/Extras/Graph-Neural-Network/.venv/lib/python3.12/site-packages/torch_geometric/nn/conv/message_passing.py:523, in MessagePassing.propagate(self, edge_index, size, **kwargs)
521 if res is not None:
522 msg_kwargs = res[0] if isinstance(res, tuple) else res
--> 523 out = self.message(**msg_kwargs)
524 for hook in self._message_forward_hooks.values():
525 res = hook(self, (msg_kwargs, ), out)
Cell In[11], line 25, in GCNConv.message(self, x, norm)
24 def message(self, x, norm):
---> 25 return norm.view(-1, 1) * x
RuntimeError: The size of tensor a (84900) must match the size of tensor b (7126) at non-singleton dimension 0"
}
- Lingua principale
- Jupyter Notebook
- Stelle
- 1.1k
- Fork
- 300
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python
-
CIDDS-001 Graph CreationAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python#22 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python#20 ·
-
HTTP Error 404: Not FoundAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python#19 · 2 commenti ·
-
Book Cover image misallignedAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 35/100
PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python#18 ·
-
HAN -Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python#16 · 1 commento ·
Tutte le issue di PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python
Issue simili
-
[Bug] Ensemble accepts invalid sample sizes until invocationForse già presa @lll-hhh l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
stanfordnlp/dspy#10752 ·
I maintainer di solito rispondono entro 1 giorno
-
.NET ep:WebGPU platform:web
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
microsoft/onnxruntime#33755 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
rohitg00/ai-engineering-from-scratch#724 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
pyg-team/pytorch_geometric#10876 ·
I maintainer di solito rispondono entro 8 giorni
-
PC
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno