code: def apply_to(x, device):
      """Apply `to` function to object x only if it has `to`."""
  
      return x.to(device) if hasattr(x, "to") else x
  
file_path: dgl/python/dgl/graphbolt/base.py
imports: from dataclasses import dataclass
  import torch
  from torch.utils.data import functional_datapipe
  from torchdata.datapipes.iter import IterDataPipe
  from ..utils import recursive_apply
label_desc: Use image node_id 5 for calling a global function with example usage: apply_to(x, device) and returns: unknown