code: def loss_gradient_check(
      estimator: "LossGradientsMixin",
      x: np.ndarray,
      y: np.ndarray,
      training_mode: bool = False,
      verbose: bool = True,
      **kwargs,
  ) -> np.ndarray:
      """
      Compute the gradient of the loss function w.r.t. `x` and identify points where the gradient is zero, nan, or inf
  
      :param estimator: The classifier to be analyzed.
      :param x: Input with shape as expected by the classifier's model.
      :param y: Target values (class labels) one-hot-encoded of shape (nb_samples, nb_classes) or indices of shape
                (nb_samples,).
      :param training_mode: `True` for model set to training mode and `'False` for model set to evaluation mode.
      :param verbose: Show progress bars.
      :return: Array of booleans with the shape (len(x), 3). If true means the gradient of the loss w.r.t. the
               particular `x` was bad (zero, nan, inf).
      """
      assert len(x) == len(y), "x and y must be the same length"
  
      is_bad = []
      for i in trange(
          len(x), desc="Gradient check", disable=not verbose
      ):
          grad = estimator.loss_gradient(
              x=x[[i]], y=y[[i]], training_mode=training_mode, **kwargs
          )
          is_bad.append(
              [
                  (np.min(grad) == 0 and np.max(grad) == 0),
                  np.any(np.isnan(grad)),
                  np.any(np.isinf(grad)),
              ]
          )
  
      return np.array(is_bad, dtype=bool)
  
imports: from typing import TYPE_CHECKING
  import numpy
  from tqdm.auto import trange
label_desc: Use image node_id 1 for calling a global function with example usage: loss_gradient_check(estimator, x, y, training_mode, verbose) and returns: np