code: def _mark_as_processed(obj: Union[torch.Tensor, List[torch.Tensor]]):
      """
      Marks parameters that have already been used in the optimizer step.
  
      DP-SGD puts certain restrictions on how gradients can be accumulated. In particular,
      no gradient can be used twice - client must call .zero_grad() between
      optimizer steps, otherwise privacy guarantees are compromised.
      This method marks tensors that have already been used in optimizer steps to then
      check if zero_grad has been duly called.
  
      Notes:
            This is used to only mark ``p.grad_sample`` and ``p.summed_grad``
  
      Args:
          obj: tensor or a list of tensors to be marked
      """
  
      if isinstance(obj, torch.Tensor):
          obj._processed = True
      elif isinstance(obj, list):
          for x in obj:
              x._processed = True
  
imports: from __future__ import annotations
  import logging
  from typing import Callable, List, Optional, Union
  import torch
  from opacus.optimizers.utils import params
  from opt_einsum.contract import contract
  from torch import nn
  from torch.optim import Optimizer
label_desc: Use image node_id 1 for calling a global function with example usage: _mark_as_processed(obj) without return types