class_docstr: Bijector to associate a numeric inverse with any invertible function.
class_docstr_tok: ["Bijector","to","associate","a","numeric","inverse","with","any","invertible","function","."]
docstr: Initialize the ScalarFunctionWithInferredInverse bijector.
  
  Args:
    fn: Python `callable` taking a single Tensor argument `x`, and returning a
      Tensor `y` of the same shape. This is assumed to be an invertible
      (continuous and monotonic) function applied elementwise to `x`.
    domain_constraint_fn: optional Python `callable` that returns values
      within the domain of `fn`, used to constrain the root search. For any
      real-valued input `r`, the value `x = domain_constraint_fn(r)` should be
      a valid input to `fn`.
      Default value: `None`.
    root_search_fn: Optional Python `callable` used to search for roots of an
      objective function. This should have signature
      `root_search_fn(objective_fn, initial_x, max_iterations=None)`
      and return a tuple containing three `Tensor`s
      `(estimated_root, objective_at_estimated_root, num_iterations)`.
      Default value: `tfp.math.secant_root`.
    max_iterations: Optional Python integer maximum number of iterations to
      run the root search algorithm.
      Default value: `50`.
    require_convergence: Optional Python `bool` indicating whether to return
      inverse values when the root-finding algorithm may not have
      converged. If `True`, such values are replaced by `NaN`.
      Default value: `True`.
    additional_scalar_parameters_requiring_gradients: Optional list of
      additional Tensor parameters with respect to which `fn` is
      differentiable. Each parameter is a (batch of) scalar(s) whose shape
      must broadcast with the shapes of `x` and `y`. Parameters are passed as
      `fn(x, *additional_scalar_parameters_requiring_gradients)`;
      explicitly passing a parameter ensures that calls to `inverse` and
      `inverse_log_det_jacobian` will generate correct gradients to that
      parameter. Parameters *not* passed here (for example,
      anything in the closure of `fn`) will not, in general, receive
      gradients.
      Default value: `()`.
    dtype: `tf.dtype` supported by this `Bijector`. `None` means dtype is not
      enforced.
      Default value: `None`.
    validate_args: Python `bool` indicating whether arguments should be
      checked for correctness.
    name: Python `str` name given to ops managed by this object.
      Default value: `scalar_function_with_inferred_inverse`.
docstr_tok: ["Initialize","the","ScalarFunctionWithInferredInverse","bijector",".","Args",":","fn",":","Python","`","callable","`","taking","a","single","Tensor","argument","`","x","`",",","and","returning","a","Tensor","`","y","`","of","the","same","shape",".","This","is","assumed","to","be","an","invertible","(","continuous","and","monotonic",")","function","applied","elementwise","to","`","x","`",".","domain_constraint_fn",":","optional","Python","`","callable","`","that","returns","values","within","the","domain","of","`","fn","`",",","used","to","constrain","the","root","search",".","For","any","real-valued","input","`","r","`",",","the","value","`","x","=","domain_constraint_fn","(","r",")","`","should","be","a","valid","input","to","`","fn","`",".","Default","value",":","`","None","`",".","root_search_fn",":","Optional","Python","`","callable","`","used","to","search","for","roots","of","an","objective","function",".","This","should","have","signature","`","root_search_fn","(","objective_fn",",","initial_x",",","max_iterations=None",")","`","and","return","a","tuple","containing","three","`","Tensor","`","s","`","(","estimated_root",",","objective_at_estimated_root",",","num_iterations",")","`",".","Default","value",":","`","tfp.math.secant_root","`",".","max_iterations",":","Optional","Python","integer","maximum","number","of","iterations","to","run","the","root","search","algorithm",".","Default","value",":","`","50","`",".","require_convergence",":","Optional","Python","`","bool","`","indicating","whether","to","return","inverse","values","when","the","root-finding","algorithm","may","not","have","converged",".","If","`","True","`",",","such","values","are","replaced","by","`","NaN","`",".","Default","value",":","`","True","`",".","additional_scalar_parameters_requiring_gradients",":","Optional","list","of","additional","Tensor","parameters","with","respect","to","which","`","fn","`","is","differentiable",".","Each","parameter","is","a","(","batch","of",")","scalar","(","s",")","whose","shape","must","broadcast","with","the","shapes","of","`","x","`","and","`","y","`",".","Parameters","are","passed","as","`","fn","(","x",",","*","additional_scalar_parameters_requiring_gradients",")","`",";","explicitly","passing","a","parameter","ensures","that","calls","to","`","inverse","`","and","`","inverse_log_det_jacobian","`","will","generate","correct","gradients","to","that","parameter",".","Parameters","*","not","*","passed","here","(","for","example",",","anything","in","the","closure","of","`","fn","`",")","will","not",",","in","general",",","receive","gradients",".","Default","value",":","`","(",")","`",".","dtype",":","`","tf.dtype","`","supported","by","this","`","Bijector","`",".","`","None","`","means","dtype","is","not","enforced",".","Default","value",":","`","None","`",".","validate_args",":","Python","`","bool","`","indicating","whether","arguments","should","be","checked","for","correctness",".","name",":","Python","`","str","`","name","given","to","ops","managed","by","this","object",".","Default","value",":","`","scalar_function_with_inferred_inverse","`","."]
code: def __init__(
      self,
      fn,
      domain_constraint_fn=None,
      root_search_fn=root_search.find_root_secant,
      max_iterations=50,
      require_convergence=True,
      additional_scalar_parameters_requiring_gradients=(),
      dtype=None,
      validate_args=False,
      name="scalar_function_with_inferred_inverse",
  ):
      """Initialize the ScalarFunctionWithInferredInverse bijector.
  
      Args:
        fn: Python `callable` taking a single Tensor argument `x`, and returning a
          Tensor `y` of the same shape. This is assumed to be an invertible
          (continuous and monotonic) function applied elementwise to `x`.
        domain_constraint_fn: optional Python `callable` that returns values
          within the domain of `fn`, used to constrain the root search. For any
          real-valued input `r`, the value `x = domain_constraint_fn(r)` should be
          a valid input to `fn`.
          Default value: `None`.
        root_search_fn: Optional Python `callable` used to search for roots of an
          objective function. This should have signature
          `root_search_fn(objective_fn, initial_x, max_iterations=None)`
          and return a tuple containing three `Tensor`s
          `(estimated_root, objective_at_estimated_root, num_iterations)`.
          Default value: `tfp.math.secant_root`.
        max_iterations: Optional Python integer maximum number of iterations to
          run the root search algorithm.
          Default value: `50`.
        require_convergence: Optional Python `bool` indicating whether to return
          inverse values when the root-finding algorithm may not have
          converged. If `True`, such values are replaced by `NaN`.
          Default value: `True`.
        additional_scalar_parameters_requiring_gradients: Optional list of
          additional Tensor parameters with respect to which `fn` is
          differentiable. Each parameter is a (batch of) scalar(s) whose shape
          must broadcast with the shapes of `x` and `y`. Parameters are passed as
          `fn(x, *additional_scalar_parameters_requiring_gradients)`;
          explicitly passing a parameter ensures that calls to `inverse` and
          `inverse_log_det_jacobian` will generate correct gradients to that
          parameter. Parameters *not* passed here (for example,
          anything in the closure of `fn`) will not, in general, receive
          gradients.
          Default value: `()`.
        dtype: `tf.dtype` supported by this `Bijector`. `None` means dtype is not
          enforced.
          Default value: `None`.
        validate_args: Python `bool` indicating whether arguments should be
          checked for correctness.
        name: Python `str` name given to ops managed by this object.
          Default value: `scalar_function_with_inferred_inverse`.
      """
      parameters = locals()
      with tf.name_scope(name):
          if domain_constraint_fn is None:
              domain_constraint_fn = lambda x: x
          self._fn = fn
          self._domain_constraint_fn = domain_constraint_fn
          self._root_search_fn = root_search_fn
          self._max_iterations = max_iterations
          self._require_convergence = require_convergence
          # TODO(davmre): for cases with lots of parameters, we might prefer to
          # support a single vector parameter in place of many scalars, so that
          # VJPs and JVPs can be computed efficiently using actual matrix ops.
          self._additional_scalar_parameters_requiring_gradients = (
              additional_scalar_parameters_requiring_gradients
          )
  
          self._bound_fn = lambda x: fn(
              x, *additional_scalar_parameters_requiring_gradients
          )
          self._inverse = self._wrap_inverse_with_implicit_gradient()
  
          super(ScalarFunctionWithInferredInverse, self).__init__(
              parameters=parameters,
              dtype=dtype,
              forward_min_event_ndims=0,
              inverse_min_event_ndims=0,
              validate_args=validate_args,
              name=name,
          )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.internal import callable_util
  from tensorflow_probability.python.internal import custom_gradient
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.math import root_search
label_desc: Use image node_id 1 to create a new ScalarFunctionWithInferredInverse object from inherited base classes: bijector with example: obj = ScalarFunctionWithInferredInverse(fn, domain_constraint_fn, root_search_fn, max_iterations, require_convergence, additional_scalar_parameters_requiring_gradients, dtype, validate_args, name)