Skip to content
Discussion options

You must be logged in to vote

Yeah, you are right. Data.__inc__ is currently only applied to PyTorch tensors. We probably need to at least omit a warning in case a user wants to increment a non-incremental object. Let me know if you have interest in adding this :)

One workaround is to save indices as a one-dimensional Tensor and to utilize torch.Tensor.split after batching:

import torch
import torch.nn as nn
from torch_geometric.data import Data
from torch_geometric.loader import DataLoader


class MyData(Data):
    def __init__(self, x, indices):
        super().__init__()
        self.x = x
        self.indices = indices
    
    def __inc__(self, key, value, *args, **kwargs):
        if key == 'indices':
            

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zhaoyu-li
Comment options

Answer selected by zhaoyu-li
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants