class_docstr: A piecewise rational quadratic spline, as developed in [1].
  
  This transformation represents a monotonically increasing piecewise rational
  quadratic function. Outside of the bounds of `knot_x`/`knot_y`, the transform
  behaves as an identity function.
  
  Typically this bijector will be used as part of a chain, with splines for
  trailing `x` dimensions conditioned on some of the earlier `x` dimensions, and
  with the inverse then solved first for unconditioned dimensions, then using
  conditioning derived from those inverses, and so forth. For example, if we
  split a 15-D `xs` vector into 3 components, we may implement a forward and
  inverse as follows:
  
  ```python
  nsplits = 3
  
  class SplineParams(tf.Module):
  
    def __init__(self, nbins=32, interval_width=2, range_min=-1,
                 min_bin_width=1e-3, min_slope=1e-3):
      self._nbins = nbins
      self._interval_width = interval_width  # Sum of bin widths.
      self._range_min = range_min  # Position of first knot.
      self._min_bin_width = min_bin_width  # Bin width lower bound.
      self._min_slope = min_slope  # Lower bound for slopes at internal knots.
      self._built = False
      self._bin_widths = None
      self._bin_heights = None
      self._knot_slopes = None
  
    def __call__(self, x, nunits):
      if not self._built:
        def _bin_positions(x):
          out_shape = tf.concat((tf.shape(x)[:-1], (nunits, self._nbins)), 0)
          x = tf.reshape(x, out_shape)
          return tf.math.softmax(x, axis=-1) * (
                self._interval_width - self._nbins * self._min_bin_width
                ) + self._min_bin_width
  
        def _slopes(x):
          out_shape = tf.concat((
            tf.shape(x)[:-1], (nunits, self._nbins - 1)), 0)
          x = tf.reshape(x, out_shape)
          return tf.math.softplus(x) + self._min_slope
  
        self._bin_widths = tf_keras.layers.Dense(
          nunits * self._nbins, activation=_bin_positions, name='w')
        self._bin_heights = tf_keras.layers.Dense(
          nunits * self._nbins, activation=_bin_positions, name='h')
        self._knot_slopes = tf_keras.layers.Dense(
          nunits * (self._nbins - 1), activation=_slopes, name='s')
        self._built = True
  
      return tfb.RationalQuadraticSpline(
        bin_widths=self._bin_widths(x),
        bin_heights=self._bin_heights(x),
        knot_slopes=self._knot_slopes(x),
        range_min=self._range_min)
  
  xs = np.random.randn(3, 15).astype(np.float32)  # Keras won't Dense(.)(vec).
  splines = [SplineParams() for _ in range(nsplits)]
  
  def spline_flow():
    stack = tfb.Identity()
    for i in range(nsplits):
      stack = tfb.RealNVP(5 * i, bijector_fn=splines[i])(stack)
    return stack
  
  ys = spline_flow().forward(xs)
  ys_inv = spline_flow().inverse(ys)  # ys_inv ~= xs
  ```
  
  For a one-at-a-time autoregressive flow as in [1], it would be profitable to
  implement a mask over `xs` to parallelize either the inverse or the forward
  pass and implement the other using a `tf.while_loop`. See
  `tfp.bijectors.MaskedAutoregressiveFlow` for support doing so (paired with
  `tfp.bijectors.Invert` depending which direction should be parallel).
  
  #### References
  
  [1]: Conor Durkan, Artur Bekasov, Iain Murray, George Papamakarios. Neural
       Spline Flows. _arXiv preprint arXiv:1906.04032_, 2019.
       https://arxiv.org/abs/1906.04032
class_docstr_tok: ["A","piecewise","rational","quadratic","spline",",","as","developed","in","[","1","]",".","This","transformation","represents","a","monotonically","increasing","piecewise","rational","quadratic","function",".","Outside","of","the","bounds","of","`","knot_x","`","\/","`","knot_y","`",",","the","transform","behaves","as","an","identity","function",".","Typically","this","bijector","will","be","used","as","part","of","a","chain",",","with","splines","for","trailing","`","x","`","dimensions","conditioned","on","some","of","the","earlier","`","x","`","dimensions",",","and","with","the","inverse","then","solved","first","for","unconditioned","dimensions",",","then","using","conditioning","derived","from","those","inverses",",","and","so","forth",".","For","example",",","if","we","split","a","15-D","`","xs","`","vector","into","3","components",",","we","may","implement","a","forward","and","inverse","as","follows",":","``","`","python","nsplits","=","3","class","SplineParams","(","tf.Module",")",":","def","__init__","(","self",",","nbins=32",",","interval_width=2",",","range_min=-1",",","min_bin_width=1e-3",",","min_slope=1e-3",")",":","self._nbins","=","nbins","self._interval_width","=","interval_width","#","Sum","of","bin","widths",".","self._range_min","=","range_min","#","Position","of","first","knot",".","self._min_bin_width","=","min_bin_width","#","Bin","width","lower","bound",".","self._min_slope","=","min_slope","#","Lower","bound","for","slopes","at","internal","knots",".","self._built","=","False","self._bin_widths","=","None","self._bin_heights","=","None","self._knot_slopes","=","None","def","__call__","(","self",",","x",",","nunits",")",":","if","not","self._built",":","def","_bin_positions","(","x",")",":","out_shape","=","tf.concat","(","(","tf.shape","(","x",")","[",":","-1","]",",","(","nunits",",","self._nbins",")",")",",","0",")","x","=","tf.reshape","(","x",",","out_shape",")","return","tf.math.softmax","(","x",",","axis=-1",")","*","(","self._interval_width","-","self._nbins","*","self._min_bin_width",")","+","self._min_bin_width","def","_slopes","(","x",")",":","out_shape","=","tf.concat","(","(","tf.shape","(","x",")","[",":","-1","]",",","(","nunits",",","self._nbins","-","1",")",")",",","0",")","x","=","tf.reshape","(","x",",","out_shape",")","return","tf.math.softplus","(","x",")","+","self._min_slope","self._bin_widths","=","tf_keras.layers.Dense","(","nunits","*","self._nbins",",","activation=_bin_positions",",","name=","'","w","'",")","self._bin_heights","=","tf_keras.layers.Dense","(","nunits","*","self._nbins",",","activation=_bin_positions",",","name=","'","h","'",")","self._knot_slopes","=","tf_keras.layers.Dense","(","nunits","*","(","self._nbins","-","1",")",",","activation=_slopes",",","name='s","'",")","self._built","=","True","return","tfb.RationalQuadraticSpline","(","bin_widths=self._bin_widths","(","x",")",",","bin_heights=self._bin_heights","(","x",")",",","knot_slopes=self._knot_slopes","(","x",")",",","range_min=self._range_min",")","xs","=","np.random.randn","(","3",",","15",")",".astype","(","np.float32",")","#","Keras","wo","n't","Dense","(",".",")","(","vec",")",".","splines","=","[","SplineParams","(",")","for","_","in","range","(","nsplits",")","]","def","spline_flow","(",")",":","stack","=","tfb.Identity","(",")","for","i","in","range","(","nsplits",")",":","stack","=","tfb.RealNVP","(","5","*","i",",","bijector_fn=splines","[","i","]",")","(","stack",")","return","stack","ys","=","spline_flow","(",")",".forward","(","xs",")","ys_inv","=","spline_flow","(",")",".inverse","(","ys",")","#","ys_inv","~=","xs","``","`","For","a","one-at-a-time","autoregressive","flow","as","in","[","1","]",",","it","would","be","profitable","to","implement","a","mask","over","`","xs","`","to","parallelize","either","the","inverse","or","the","forward","pass","and","implement","the","other","using","a","`","tf.while_loop","`",".","See","`","tfp.bijectors.MaskedAutoregressiveFlow","`","for","support","doing","so","(","paired","with","`","tfp.bijectors.Invert","`","depending","which","direction","should","be","parallel",")",".","#","#","#","#","References","[","1","]",":","Conor","Durkan",",","Artur","Bekasov",",","Iain","Murray",",","George","Papamakarios",".","Neural","Spline","Flows",".","_arXiv","preprint","arXiv:1906.04032_",",","2019.","https",":","\/\/arxiv.org\/abs\/1906.04032"]
code: def range_min(self):
      return self._range_min
  
imports: import collections
  import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 6 for calling the RationalQuadraticSpline obj's underlying member method code with example usage: obj.range_min() and returns: self