code: def error_due_to_ill_conditioning(f, *args):
      """Returns relative error to expect in `f(*args)` due to conditioning.
  
      This function assumes that `f` is differentiable, and that numerical
      error when computing `f` or its derivatives in float64 is
      negligible.  One necessary condition for this to work correctly is
      that `f` be _dtype-polymorphic_: the dtype in which computations
      internal to `f` (and its derivatives) are performed should match the
      dtype of the arguments of `f`.
  
      The current implementation of this function evaluates ill
      conditioning of `f` independently for each argument.  It would
      perhaps be more faithful to accepted practice to compute the
      multivariate condition number instead, which takes account of errors
      caused by coordinated rounding among the inputs.
  
      The function `f` must return a single scalar output; batching and
      vector outputs from `f` are not currently supported.
  
      Args:
        f: Function whose accuracy to evaluate.  Must be differentiable
          and dtype-polymorphic.
        *args: Arguments at which to assess the accuracy of `f`.
  
      Returns:
        relerr: A scalar float64 Tensor.  The relative error when
          computing `f(*args)` in float32 that should be expected due to
          ill conditioning of `f`.
  
      Raises:
        ValueError: If `f` is found not to be dtype-polymorphic.
  
      """
      condition_numbers = inputwise_condition_numbers(f, *args)
      logging.vlog(
          1, "Inputwise condition numbers: %s", condition_numbers
      )
      rounding_errors = tf.nest.map_structure(
          lambda x, k: rounding_error(x) * k, args, condition_numbers
      )
      logging.vlog(
          1,
          "Relative error due to rounding each argument: %s",
          rounding_errors,
      )
      return tf.reduce_max(_full_flatten(rounding_errors), axis=-1)
  
file_path: probability/tensorflow_probability/python/internal/numerics_testing.py
imports: import functools
  from absl import logging
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 10 for calling a global function with example usage: error_due_to_ill_conditioning(f) and returns: tf