code: def implements_per_sample_grads(torch_function):
      @functools.wraps(torch_function)
      def decorator(autograd_func):
          HANDLED_FUNCTIONS[torch_function] = autograd_func
          return autograd_func
  
      return decorator
  
imports: from contextlib import contextmanager
  import torch
  import functools
  from torch._decomp import decomposition_table
  from typing import Callable, Dict
  from torch.utils._pytree import tree_map_only
label_desc: Use image node_id 4 for calling a global function with example usage: implements_per_sample_grads(torch_function) and returns: decorator, autograd_func