code: def safepow(
      a: torch.Tensor, p: torch.Tensor, eps: float = 1e-12
  ) -> torch.Tensor:
      """Safely calculate the power of a tensor with a small eps to avoid nan.
  
      Examples
      --------
      >>> import torch
      >>> a = torch.tensor([1e-35, 2e-40])
      >>> p = torch.tensor([2., 3])
      >>> safepow(a, p)
      tensor([1.0000e-24, 1.0000e-36])
      >>> a**p
      tensor([0., 0.])
  
      Parameters
      ----------
      a: torch.Tensor
          Base tensor on which to calculate the power. Must be positive.
      p: torch.Tensor
          Power tensor, by which to calculate the power.
      eps: float (default 1e-12)
          The eps to add to the base tensor.
  
      Returns
      -------
      torch.Tensor
          The result tensor.
  
      Raises
      ------
      RuntimeError
          If the base tensor contains negative values.
  
      """
      if torch.any(a < 0):
          raise RuntimeError("safepow only works for positive base")
      base = torch.sqrt(a * a + eps * eps)  # soft clip
      return base**p
  
file_path: deepchem/deepchem/utils/safeops_utils.py
imports: import math
  import torch
  from typing import Union, Optional, Tuple
label_desc: Use image node_id 1 for calling a global function with example usage: safepow(a, p, eps) and returns: unknown