class_docstr: A custom type for data that can be moved to a torch device via `.to(...)`.
  Example::
  
      >>> isinstance(dict, TorchTransferableDataType)
      False
      >>> isinstance(torch.rand(2, 3), TorchTransferableDataType)
      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(), TorchTransferableDataType)
      True
code: def __subclasshook__(cls, subclass: Any) -> Union[bool, Any]:
      if cls is TorchTransferableDataType:
          to = getattr(subclass, "to", None)
          return callable(to)
      return NotImplemented
  
file_path: fastNLP/fastNLP/core/utils/torch_utils.py
imports: from abc import ABC
  from typing import Any, Union, Optional
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH, _TORCH_GREATER_EQUAL_1_8
  from .utils import apply_to_collection
label_desc: Use image node_id 1 for calling the TorchTransferableDataType obj's underlying member method code with example usage: obj.__subclasshook__(cls, subclass) and returns: NotImplemented, callable