code: def _check_processed_flag_tensor(x: torch.Tensor):
      """
      Checks if this gradient tensor has been previously used in optimization step.
  
      See Also:
          :meth:`~opacus.optimizers.optimizer._mark_as_processed`
  
      Args:
          x: gradient tensor
  
      Raises:
          ValueError
              If tensor has attribute ``._processed`` previously set by
              ``_mark_as_processed`` method
      """
  
      if hasattr(x, "_processed"):
          raise ValueError(
              "Gradients haven't been cleared since the last optimizer step. "
              "In order to obtain privacy guarantees you must call optimizer.zero_grad()"
              "on each step"
          )
  
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 2 for calling a global function with example usage: _check_processed_flag_tensor(x) without return types