Skip to content

Instantly share code, notes, and snippets.

@sidneyarcidiacono
Created May 17, 2021 20:57
Show Gist options
  • Save sidneyarcidiacono/1272af21d899abf1a55f898ab2b8c6a7 to your computer and use it in GitHub Desktop.
Save sidneyarcidiacono/1272af21d899abf1a55f898ab2b8c6a7 to your computer and use it in GitHub Desktop.
Initialize loaders for batching with pytorch-geometric
# Import DataLoader for batching
from torch_geometric.data import DataLoader
# our DataLoader creates diagonal adjacency matrices, and concatenates features
# and target matrices in the node dimension. This allows differing numbers of nodes and edges
# over examples in one batch. (from pytorch geometric docs)
train_loader = DataLoader(train_dataset, batch_size=64, shuffle=True)
test_loader = DataLoader(test_dataset, batch_size=64, shuffle=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment