🐛 Describe the bug
Per title
Min-repro:
from typing import NamedTuple
import torch
from torchdata.datapipes.utils import pin_memory_fn
class NamedTensors(NamedTuple):
a: torch.Tensor
b: torch.Tensor
data = NamedTensors(torch.tensor(1), torch.tensor(2))
print(pin_memory_fn(data)) # None
To fix it, we just need to add a return https://github.com/pytorch/data/blob/fea20d416cd40e23ee949e09f0f5a7858fcc3542/torchdata/datapipes/utils/pin_memory.py#L30
Versions
main branch