chain_binomial_rippler.py
def _dispatch_update(z, x, p, xs, ps, seed=None, validate_args=False):
    """Dispatches update function based on values of 
       parameters.

    **This is purely a scalar function due to random_hypergeom**

    :param z: current $z$
    :param x: current $x$
    :param p: $p$ current probability
    :param xs: $x^\star$ new state
    :param ps: $p_star$ new probability

    :returns: an updated number of events
    """
    with tf.name_scope("dispatch_update"):
        p = tf.convert_to_tensor(p)
        ps = tf.convert_to_tensor(ps)
        z = tf.cast(z, p.dtype)
        x = tf.cast(x, p.dtype)
        xs = tf.cast(xs, p.dtype)

        seeds = samplers.split_seed(seed, salt="_dispatch_update")

        # Update for p->ps first
        idx = tf.cast(tf.math.sign(ps - p), tf.int32) + 1
        z_prime = tf.switch_case(
            tf.squeeze(idx),
            [
                lambda: _psltp(z, p, ps, seeds[0], validate_args),
                lambda: z,
                lambda: _psgtp(z, x, p, ps, seeds[0], validate_args),
            ],
            name="switch_step_0",
        )

        idx = tf.cast(tf.math.sign(xs - x), tf.int32) + 1
        z_new = tf.switch_case(
            tf.squeeze(idx),
            [
                lambda: _xsltx(z_prime, x, xs, seeds[1], validate_args),
                lambda: z_prime,
                lambda: _xsgtx(z_prime, x, xs, ps, seeds[1], validate_args),
            ],
            name="switch_step_1",
        )

        return z_new
Dispatches update function based on values of 
       parameters.

    **This is purely a scalar function due to random_hypergeom**

    :param z: current $z$
    :param x: current $x$
    :param p: $p$ current probability
    :param xs: $x^\star$ new state
    :param ps: $p_star$ new probability

    :returns: an updated number of events
    
Dispatches update function based on values of
parameters.

This is purely a scalar function due to random_hypergeom
Dispatches update function based on values of parameters . This is purely a scalar function due to random_hypergeom
def _dispatch_update(z, x, p, xs, ps, seed=None, validate_args=False):
    with tf.name_scope("dispatch_update"):
        p = tf.convert_to_tensor(p)
        ps = tf.convert_to_tensor(ps)
        z = tf.cast(z, p.dtype)
        x = tf.cast(x, p.dtype)
        xs = tf.cast(xs, p.dtype)
        seeds = samplers.split_seed(seed, salt="_dispatch_update")
        idx = tf.cast(tf.math.sign(ps - p), tf.int32) + 1
        z_prime = tf.switch_case(
            tf.squeeze(idx),
            [
                lambda: _psltp(z, p, ps, seeds[0], validate_args),
                lambda: z,
                lambda: _psgtp(z, x, p, ps, seeds[0], validate_args),
            ],
            name="switch_step_0",
        )
        idx = tf.cast(tf.math.sign(xs - x), tf.int32) + 1
        z_new = tf.switch_case(
            tf.squeeze(idx),
            [
                lambda: _xsltx(z_prime, x, xs, seeds[1], validate_args),
                lambda: z_prime,
                lambda: _xsgtx(z_prime, x, xs, ps, seeds[1], validate_args),
            ],
            name="switch_step_1",
        )
        return z_new
def _dispatch_update ( z , x , p , xs , ps , seed = None , validate_args = False ) : with tf . name_scope ( "dispatch_update" ) : p = tf . convert_to_tensor ( p ) ps = tf . convert_to_tensor ( ps ) z = tf . cast ( z , p . dtype ) x = tf . cast ( x , p . dtype ) xs = tf . cast ( xs , p . dtype ) seeds = samplers . split_seed ( seed , salt = "_dispatch_update" ) idx = tf . cast ( tf . math . sign ( ps - p ) , tf . int32 ) + 1 z_prime = tf . switch_case ( tf . squeeze ( idx ) , [ lambda : _psltp ( z , p , ps , seeds [ 0 ] , validate_args ) , lambda : z , lambda : _psgtp ( z , x , p , ps , seeds [ 0 ] , validate_args ) , ] , name = "switch_step_0" , ) idx = tf . cast ( tf . math . sign ( xs - x ) , tf . int32 ) + 1 z_new = tf . switch_case ( tf . squeeze ( idx ) , [ lambda : _xsltx ( z_prime , x , xs , seeds [ 1 ] , validate_args ) , lambda : z_prime , lambda : _xsgtx ( z_prime , x , xs , ps , seeds [ 1 ] , validate_args ) , ] , name = "switch_step_1" , ) return z_new
Dispatches update function based on values of
parameters.
Dispatches update function based on values of parameters .
"""Dispatches update function based on values of 
       parameters.

    **This is purely a scalar function due to random_hypergeom**

    :param z: current $z$
    :param x: current $x$
    :param p: $p$ current probability
    :param xs: $x^\star$ new state
    :param ps: $p_star$ new probability

    :returns: an updated number of events
    """ # Update for p->ps first
an updated number of events
an updated number of events
z
None
x
None
p
$p$ current probability
$p$ current probability
xs
$x^\star$ new state
$x^ \ star$ new state
ps
$p_star$ new probability
$p_star$ new probability
seed
validate_args