class_docstr: A custom type for data that can be moved to a torch device via ``.to(...)``.
  
  Example:
  
      >>> isinstance(dict, _TransferableDataType)
      False
      >>> isinstance(torch.rand(2, 3), _TransferableDataType)
      True
      >>> class CustomObject:
      ...     def __init__(self):
      ...         self.x = torch.rand(2, 2)
      ...     def to(self, device):
      ...         self.x = self.x.to(device)
      ...         return self
      >>> isinstance(CustomObject(), _TransferableDataType)
      True
class_docstr_tok: ["A","custom","type","for","data","that","can","be","moved","to","a","torch","device","via","``",".to","(","...",")","``",".","Example",":",">",">",">","isinstance","(","dict",",","_TransferableDataType",")","False",">",">",">","isinstance","(","torch.rand","(","2",",","3",")",",","_TransferableDataType",")","True",">",">",">","class","CustomObject",":","...","def","__init__","(","self",")",":","...","self.x","=","torch.rand","(","2",",","2",")","...","def","to","(","self",",","device",")",":","...","self.x","=","self.x.to","(","device",")","...","return","self",">",">",">","isinstance","(","CustomObject","(",")",",","_TransferableDataType",")","True"]
code: def __subclasshook__(cls, subclass: Any) -> Union[bool, Any]:
      if cls is _TransferableDataType:
          to = getattr(subclass, "to", None)
          return callable(to)
      return NotImplemented
  
file_path: pytorch-lightning/src/lightning/fabric/utilities/apply_func.py
imports: from abc import ABC
  from functools import partial
  from typing import Any, Callable, List, Tuple, Union
  import numpy
  import torch
  from lightning_utilities.core.apply_func import apply_to_collection
  from torch import Tensor
  from lightning.fabric.utilities.types import _DEVICE
label_desc: Use image node_id 1 for calling the _TransferableDataType obj's underlying member method code with example usage: obj.__subclasshook__(cls, subclass) and returns: NotImplemented, callable