code: def sp_power(A: SparseMatrix, scalar: Scalar) -> SparseMatrix:
      """Take the power of each nonzero element and return a sparse matrix with
      the result.
  
      Parameters
      ----------
      A : SparseMatrix
          Sparse matrix
      scalar : float or int
          Exponent
  
      Returns
      -------
      SparseMatrix
          Sparse matrix
  
      Examples
      --------
      >>> indices = torch.tensor([[1, 0, 2], [0, 3, 2]])
      >>> val = torch.tensor([10, 20, 30])
      >>> A = dglsp.spmatrix(indices, val)
      >>> A ** 2
      SparseMatrix(indices=tensor([[1, 0, 2],
                                   [0, 3, 2]]),
      values=tensor([100, 400, 900]),
      shape=(3, 4), nnz=3)
      """
      # Python falls back to scalar.__rpow__ then TypeError when NotImplemented
      # is returned.
      return (
          val_like(A, A.val**scalar)
          if is_scalar(scalar)
          else NotImplemented
      )
  
file_path: dgl/python/dgl/sparse/elementwise_op_sp.py
imports: from typing import Union
  import torch
  from .sparse_matrix import SparseMatrix, val_like
  from .utils import is_scalar, Scalar
label_desc: Use image node_id 8 for calling a global function with example usage: sp_power(A, scalar) and returns: unknown