code: def log(self, input_in_01=False):
      r"""
      Approximates the natural logarithm using 8th order modified
      Householder iterations. This approximation is accurate within 2% relative
      error on [0.0001, 250].
  
      Iterations are computed by: :math:`h = 1 - x * exp(-y_n)`
  
      .. math::
  
          y_{n+1} = y_n - \sum_k^{order}\frac{h^k}{k}
  
      Args:
          input_in_01 (bool) : Allows a user to indicate that the input is in the domain [0, 1],
              causing the function optimize for this domain. This is useful for computing
              log-probabilities for entropy functions.
  
              We shift the domain of convergence by a constant :math:`a` using the following identity:
  
              .. math::
  
                  \ln{u} = \ln {au} - \ln{a}
  
              Since the domain of convergence for CrypTen's log() function is approximately [1e-4, 1e2],
              we can set :math:`a=100`.
  
      Configuration parameters:
          iterations (int): number of Householder iterations for the approximation
          exp_iterations (int): number of iterations for limit approximation of exp
          order (int): number of polynomial terms used (order of Householder approx)
      """
      if input_in_01:
          return log(self.mul(100)) - 4.605170
  
      # Initialization to a decent estimate (found by qualitative inspection):
      #                ln(x) = x/120 - 20exp(-2x - 1.0) + 3.0
      iterations = cfg.functions.log_iterations
      exp_iterations = cfg.functions.log_exp_iterations
      order = cfg.functions.log_order
  
      term1 = self.div(120)
      term2 = exp(self.mul(2).add(1.0).neg()).mul(20)
      y = term1 - term2 + 3.0
  
      # 8th order Householder iterations
      with cfg.temp_override(
          {"functions.exp_iterations": exp_iterations}
      ):
          for _ in range(iterations):
              h = 1 - self * exp(-y)
              y -= h.polynomial([1 / (i + 1) for i in range(order)])
      return y
  
file_path: CrypTen/crypten/common/functions/approximations.py
imports: import math
  import crypten
  import torch
  from crypten.config import cfg
label_desc: Use image node_id 2 for calling a global function with example usage: log(input_in_01) and returns: y, unknown