code: def _is_grad_tensor(obj) -> bool:
      if torch.is_tensor(obj):
          if obj.grad_fn is not None or obj.requires_grad:
              return True
      return False
  
imports: from abc import ABC, abstractmethod
  from contextlib import contextmanager
  from typing import Any, List, Tuple
  import torch
  from torch.utils._pytree import TreeSpec, tree_flatten, tree_unflatten
label_desc: Use image node_id 1 for calling a global function with example usage: _is_grad_tensor(obj) and returns: False, True