code: def row_norms(X, squared=False):
      """Row-wise (squared) Euclidean norm of X.
  
      Equivalent to np.sqrt((X * X).sum(axis=1)), but also supports sparse
      matrices.
  
      Performs no input validation.
  
      Parameters
      ----------
      X : array_like
          The input array
      squared : bool, optional (default = False)
          If True, return squared norms.
  
      Returns
      -------
      array_like
          The row-wise (squared) Euclidean norm of X.
      """
      if sparse.issparse(X):
          if isinstance(
              X,
              (sparse.csr_matrix, sparse.csc_matrix, sparse.coo_matrix),
          ):
              X_copy = X.copy()
              X_copy.data = np.square(X_copy.data)
              norms = X_copy.sum(axis=1).squeeze()
          else:
              raise ValueError("Sparse matrix not compatible")
      else:
          norms = np.einsum("ij,ij->i", X, X)
  
      if not squared:
          np.sqrt(norms, norms)
      return norms
  
imports: from cuml.internals.safe_imports import gpu_only_import_from
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 1 for calling a global function with example usage: row_norms(X, squared) and returns: norms