code: def deep_to(obj, *args, **kwargs):
      r"""
      Create a deep copy of an arbitrary Python object, calling ``.to(*args,
      **kwargs)`` on all :class:`torch.Tensor` s and :class:`torch.nn.Module` s
      in that object.
  
      Like :meth:`torch.Tensor.to` but unlike :meth:`torch.nn.Module.to`, this
      creates new objects. For compatibility with existing PyTorch module
      behavior, this first calls :meth:`torch.nn.Module.to` in-place, then
      creates a deep copy of the module.
  
      :param obj: Any python object.
      :param \*args:
      :param \*\*kwargs: See :meth:`torch.Tensor.to`.
      :returns: A deep copy of ``obj`` with all :class:`torch.Tensor` s and
          :class:`torch.nn.Module` s mapped.
      """
      memo = _DeepToMemo(args, kwargs)
      return copy.deepcopy(obj, memo)
  
imports: import copy
  import ctypes
  import functools
  import numbers
  import weakref
  from contextlib import contextmanager
  import torch
  import torch.distributions
  from torch import logsumexp
  from torch.distributions.utils import broadcast_all
  from pyro.util import ignore_jit_warnings
  from ..None import settings
label_desc: Use image node_id 4 for calling a global function with example usage: deep_to(obj) and returns: copy