code: def from_one_hot(y: np.ndarray, axis: int = 1) -> np.ndarray:
      """Transforms label vector from one-hot encoding.
  
      Parameters
      ----------
      y: np.ndarray
          A vector of shape `(n_samples, num_classes)`
      axis: int, optional (default 1)
          The axis with one-hot encodings to reduce on.
  
      Returns
      -------
      np.ndarray
          A numpy array of shape `(n_samples,)`
      """
      return np.argmax(y, axis=axis)
  
file_path: deepchem/deepchem/metrics/metric.py
imports: import logging
  from typing import Any, Callable, Optional
  import numpy
  from numpy.typing import ArrayLike
label_desc: Use image node_id 7 for calling a global function with example usage: from_one_hot(y, axis) and returns: np