`Batch.from_data_list` only store node/edge types of first element for `HeteroData`

Author: PeterDavison01Created Sep 7, 2026Updated Sep 7, 2026
Labelsdocumentation

Describe the documentation issue

Related to #7156. I left a comment (here) on the stale request the other month but wanted to raise the request. I've been struggling with the lack of a clear failure. This behaviour does not appear to be documented in the public docs for DataLoader / Batch.from_data_list() / HeteroData or the Heterogeneous Graph learning tutorial as far as I am aware. I couldn't find a built-in validation check in the docs as well, which leads to silent data loss. With shuffle=True it is especially painful; which subset of stores survives depends on whichever graph happens to land in data_list[0] for that batch (assuming no static seed is set), so the same dataset produces different x_dict.keys() from step to step.

For datasets with a wide, sparse type vocabulary (industrial timelines in my case, but the same shape shows up in molecular datasets with sparse atom types, etc.), a given graph naturally only touches a subset of the schema, so this failure mode is easy to hit without realising it.

Suggest a potential alternative/fix

Would you consider adding a docs note about the store key requirement and the “pad with empty tensors” workaround, or a warning in collate()?

Source: pyg-team/pytorch_geometric