DataModule knowledge of device?

In a datamodule, how can I detect whether the trainer/lightning module is running on GPU? this is needed for setting pin_memory on the dataloader? If i’m defining my train_dataloader function in the lightning module, I can rely on the on_gpu property. not sure what the equivalent is for data modules

Use self.trainer.on_gpu within the datamodule!