class_docstr: `ConcreteProxy` is a wrapped proxy carried the real intermediate value.
  We can use it to trace a more compatible model, and pass the branches.
class_docstr_tok: ["`","ConcreteProxy","`","is","a","wrapped","proxy","carried","the","real","intermediate","value",".","We","can","use","it","to","trace","a","more","compatible","model",",","and","pass","the","branches","."]
code: def __torch_function__(
      cls, orig_method, types, args=None, kwargs=None
  ):
      # to wrap all the functions/methods with tensor inputs in the namespace 'torch.*'.
      # actually a simple way to do wrap, but may get wrong in functions with no tensor inputs.
      # TODO: now for most functions in torch namespace, we do wrap directly and not use __torch_function__
  
      args = args if args else ()
      kwargs = kwargs if kwargs else {}
  
      tracers: Set[Any] = _orig_set()
  
      def find_tracer(a):
          if _orig_isinstance(a, cls):
              tracers.add(a.tracer)
  
      map_recursive(find_tracer, args)
      map_recursive(find_tracer, kwargs)
  
      if _orig_len(tracers) > 1:
          raise RuntimeError(
              f"Found multiple different tracers {_orig_list(tracers)} while "
              f"trying to trace operations {orig_method}"
          )
      (tracer,) = tracers
  
      if isinstance(orig_method, torch._C.ScriptMethod):
          args = (orig_method.owner,) + args
          return tracer.create_proxy(
              "call_method", orig_method.name, args, kwargs
          )
      if is_tensor_method_or_property(orig_method):
          return tracer.create_proxy(
              "call_method", orig_method.__name__, args, kwargs
          )
      else:
          return tracer.create_proxy(
              "call_function",
              orig_method,
              args,
              kwargs,
              name=tracer.graph._target_to_str(orig_method.__name__),
          )
  
imports: from __future__ import annotations
  import dis
  import logging
  import inspect
  import operator
  from typing import List, Optional, Iterable, Any, Set, Union
  import torch
  from torch.fx._compatibility import compatibility
  from torch.fx.graph import magic_methods, reflectable_magic_methods
  from torch.fx.node import Node
  from torch.fx.proxy import Proxy
  from torch.overrides import is_tensor_method_or_property
  from .None import concrete_tracer
  from .utils import _orig_tuple, _orig_list, _orig_type, _orig_isinstance, _orig_getattr, _orig_range, _orig_dict, _orig_len, _orig_index, _orig_bool, _orig_slice, _orig_set, map_recursive
label_desc: Use image node_id 16 for calling the ConcreteProxy obj's underlying member method code with example usage: obj.__torch_function__(cls, orig_method, types, args, kwargs) and returns: tracer, tracer, tracer