code: def _is_to_device_method_overridden(device_resident, method_name):
      # Returns whether the specified to_device family method is overridden.
      to_method = getattr(device_resident, method_name, None).__func__
      to_method_orig = getattr(DeviceResident, method_name)
      if sys.version_info < (3,):
          to_method_orig = to_method_orig.__func__
      if to_method is not to_method_orig:
          return True  # overridden
      return False
  
imports: from __future__ import absolute_import
  import abc
  import sys
  import threading
  import typing
  import warnings
  import numpy
  import chainer
  from chainer import backend
  from chainer.backends import _cpu
  from chainer.backends import cuda
  from chainer.backends import intel64
  from chainer import types
  from chainer import utils
  import chainerx
label_desc: Use image node_id 1 for calling a global function with example usage: _is_to_device_method_overridden(device_resident, method_name) and returns: False, True