class_docstr: Sequential Monte Carlo transition kernel.
  
  Sequential Monte Carlo maintains a population of weighted particles
  representing samples from a sequence of target distributions. It is
  *not* a calibrated MCMC kernel: the transitions step through a sequence of
  target distributions, rather than trying to maintain a stationary
  distribution.
class_docstr_tok: ["Sequential","Monte","Carlo","transition","kernel",".","Sequential","Monte","Carlo","maintains","a","population","of","weighted","particles","representing","samples","from","a","sequence","of","target","distributions",".","It","is","*","not","*","a","calibrated","MCMC","kernel",":","the","transitions","step","through","a","sequence","of","target","distributions",",","rather","than","trying","to","maintain","a","stationary","distribution","."]
docstr: Initializes a sequential Monte Carlo transition kernel.
  
  Args:
    propose_and_update_log_weights_fn: Python `callable` with signature
      `new_weighted_particles = propose_and_update_log_weights_fn(step,
      weighted_particles, seed=None)`. Its input is a
      `tfp.experimental.mcmc.WeightedParticles` structure representing
      weighted samples (with normalized weights) from the `step`th
      target distribution, and it returns another such structure representing
      unnormalized weighted samples from the next (`step + 1`th) target
      distribution. This will typically include particles
      sampled from a proposal distribution `q(x[step + 1] | x[step])`, and
      weights that account for some or all of: the proposal density,
      a transition density `p(x[step + 1] | x[step]),
      observation weights `p(y[step + 1] | x[step + 1])`, and/or a backwards
      or 'L'-kernel `L(x[step] | x[step + 1])`. The (log) normalization
      constant of the weights is interpreted as the incremental (log) marginal
      likelihood.
    resample_fn: Resampling scheme specified as a `callable` with signature
      `indices = resample_fn(log_probs, event_size, sample_shape, seed)`,
      where `log_probs` is a `Tensor` of the same shape as `state.log_weights`
      containing a normalized log-probability for every current
      particle, `event_size` is the number of new particle indices to
      generate,  `sample_shape` is the number of independent index sets to
      return, and the  return value `indices` is an `int` Tensor of shape
      `concat([sample_shape, [event_size, B1, ..., BN])`. Typically one of
      `tfp.experimental.mcmc.resample_deterministic_minimum_error`,
      `tfp.experimental.mcmc.resample_independent`,
      `tfp.experimental.mcmc.resample_stratified`, or
      `tfp.experimental.mcmc.resample_systematic`.
      Default value: `tfp.experimental.mcmc.resample_systematic`.
    resample_criterion_fn: optional Python `callable` with signature
      `do_resample = resample_criterion_fn(weighted_particles)`,
      passed an instance of `tfp.experimental.mcmc.WeightedParticles`. The
      return value `do_resample`
      determines whether particles are resampled at the current step. The
      default behavior is to resample particles when the effective
      sample size falls below half of the total number of particles.
      Default value: `tfp.experimental.mcmc.ess_below_threshold`.
    unbiased_gradients: If `True`, use the stop-gradient
      resampling trick of Scibior, Masrani, and Wood [{scibor_ref_idx}] to
      correct for gradient bias introduced by the discrete resampling step.
      This will generally increase the variance of stochastic gradients.
      Default value: `True`.
    particles_dim: `int` dimension that indexes the particles in the
      `tfp.experimental.mcmc.WeightedParticles` structures on which this
      kernel operates.
      Default value: `0`.
    name: Python `str` name for ops created by this kernel.
  
  #### References
  
  [1] Adam Scibior, Vaden Masrani, and Frank Wood. Differentiable Particle
      Filtering without Modifying the Forward Pass. _arXiv preprint
      arXiv:2106.10314_, 2021. https://arxiv.org/abs/2106.10314
docstr_tok: ["Initializes","a","sequential","Monte","Carlo","transition","kernel",".","Args",":","propose_and_update_log_weights_fn",":","Python","`","callable","`","with","signature","`","new_weighted_particles","=","propose_and_update_log_weights_fn","(","step",",","weighted_particles",",","seed=None",")","`",".","Its","input","is","a","`","tfp.experimental.mcmc.WeightedParticles","`","structure","representing","weighted","samples","(","with","normalized","weights",")","from","the","`","step","`","th","target","distribution",",","and","it","returns","another","such","structure","representing","unnormalized","weighted","samples","from","the","next","(","`","step","+","1","`","th",")","target","distribution",".","This","will","typically","include","particles","sampled","from","a","proposal","distribution","`","q","(","x","[","step","+","1","]","|","x","[","step","]",")","`",",","and","weights","that","account","for","some","or","all","of",":","the","proposal","density",",","a","transition","density","`","p","(","x","[","step","+","1","]","|","x","[","step","]",")",",","observation","weights","`","p","(","y","[","step","+","1","]","|","x","[","step","+","1","]",")","`",",","and\/or","a","backwards","or","'","L'-kernel","`","L","(","x","[","step","]","|","x","[","step","+","1","]",")","`",".","The","(","log",")","normalization","constant","of","the","weights","is","interpreted","as","the","incremental","(","log",")","marginal","likelihood",".","resample_fn",":","Resampling","scheme","specified","as","a","`","callable","`","with","signature","`","indices","=","resample_fn","(","log_probs",",","event_size",",","sample_shape",",","seed",")","`",",","where","`","log_probs","`","is","a","`","Tensor","`","of","the","same","shape","as","`","state.log_weights","`","containing","a","normalized","log-probability","for","every","current","particle",",","`","event_size","`","is","the","number","of","new","particle","indices","to","generate",",","`","sample_shape","`","is","the","number","of","independent","index","sets","to","return",",","and","the","return","value","`","indices","`","is","an","`","int","`","Tensor","of","shape","`","concat","(","[","sample_shape",",","[","event_size",",","B1",",","...",",","BN","]",")","`",".","Typically","one","of","`","tfp.experimental.mcmc.resample_deterministic_minimum_error","`",",","`","tfp.experimental.mcmc.resample_independent","`",",","`","tfp.experimental.mcmc.resample_stratified","`",",","or","`","tfp.experimental.mcmc.resample_systematic","`",".","Default","value",":","`","tfp.experimental.mcmc.resample_systematic","`",".","resample_criterion_fn",":","optional","Python","`","callable","`","with","signature","`","do_resample","=","resample_criterion_fn","(","weighted_particles",")","`",",","passed","an","instance","of","`","tfp.experimental.mcmc.WeightedParticles","`",".","The","return","value","`","do_resample","`","determines","whether","particles","are","resampled","at","the","current","step",".","The","default","behavior","is","to","resample","particles","when","the","effective","sample","size","falls","below","half","of","the","total","number","of","particles",".","Default","value",":","`","tfp.experimental.mcmc.ess_below_threshold","`",".","unbiased_gradients",":","If","`","True","`",",","use","the","stop-gradient","resampling","trick","of","Scibior",",","Masrani",",","and","Wood","[","{","scibor_ref_idx","}","]","to","correct","for","gradient","bias","introduced","by","the","discrete","resampling","step",".","This","will","generally","increase","the","variance","of","stochastic","gradients",".","Default","value",":","`","True","`",".","particles_dim",":","`","int","`","dimension","that","indexes","the","particles","in","the","`","tfp.experimental.mcmc.WeightedParticles","`","structures","on","which","this","kernel","operates",".","Default","value",":","`","0","`",".","name",":","Python","`","str","`","name","for","ops","created","by","this","kernel",".","#","#","#","#","References","[","1","]","Adam","Scibior",",","Vaden","Masrani",",","and","Frank","Wood",".","Differentiable","Particle","Filtering","without","Modifying","the","Forward","Pass",".","_arXiv","preprint","arXiv:2106.10314_",",","2021.","https",":","\/\/arxiv.org\/abs\/2106.10314"]
code: def __init__(
      self,
      propose_and_update_log_weights_fn,
      resample_fn=weighted_resampling.resample_systematic,
      resample_criterion_fn=ess_below_threshold,
      unbiased_gradients=True,
      particles_dim=0,
      name=None,
  ):
      """Initializes a sequential Monte Carlo transition kernel.
  
      Args:
        propose_and_update_log_weights_fn: Python `callable` with signature
          `new_weighted_particles = propose_and_update_log_weights_fn(step,
          weighted_particles, seed=None)`. Its input is a
          `tfp.experimental.mcmc.WeightedParticles` structure representing
          weighted samples (with normalized weights) from the `step`th
          target distribution, and it returns another such structure representing
          unnormalized weighted samples from the next (`step + 1`th) target
          distribution. This will typically include particles
          sampled from a proposal distribution `q(x[step + 1] | x[step])`, and
          weights that account for some or all of: the proposal density,
          a transition density `p(x[step + 1] | x[step]),
          observation weights `p(y[step + 1] | x[step + 1])`, and/or a backwards
          or 'L'-kernel `L(x[step] | x[step + 1])`. The (log) normalization
          constant of the weights is interpreted as the incremental (log) marginal
          likelihood.
        resample_fn: Resampling scheme specified as a `callable` with signature
          `indices = resample_fn(log_probs, event_size, sample_shape, seed)`,
          where `log_probs` is a `Tensor` of the same shape as `state.log_weights`
          containing a normalized log-probability for every current
          particle, `event_size` is the number of new particle indices to
          generate,  `sample_shape` is the number of independent index sets to
          return, and the  return value `indices` is an `int` Tensor of shape
          `concat([sample_shape, [event_size, B1, ..., BN])`. Typically one of
          `tfp.experimental.mcmc.resample_deterministic_minimum_error`,
          `tfp.experimental.mcmc.resample_independent`,
          `tfp.experimental.mcmc.resample_stratified`, or
          `tfp.experimental.mcmc.resample_systematic`.
          Default value: `tfp.experimental.mcmc.resample_systematic`.
        resample_criterion_fn: optional Python `callable` with signature
          `do_resample = resample_criterion_fn(weighted_particles)`,
          passed an instance of `tfp.experimental.mcmc.WeightedParticles`. The
          return value `do_resample`
          determines whether particles are resampled at the current step. The
          default behavior is to resample particles when the effective
          sample size falls below half of the total number of particles.
          Default value: `tfp.experimental.mcmc.ess_below_threshold`.
        unbiased_gradients: If `True`, use the stop-gradient
          resampling trick of Scibior, Masrani, and Wood [{scibor_ref_idx}] to
          correct for gradient bias introduced by the discrete resampling step.
          This will generally increase the variance of stochastic gradients.
          Default value: `True`.
        particles_dim: `int` dimension that indexes the particles in the
          `tfp.experimental.mcmc.WeightedParticles` structures on which this
          kernel operates.
          Default value: `0`.
        name: Python `str` name for ops created by this kernel.
  
      #### References
  
      [1] Adam Scibior, Vaden Masrani, and Frank Wood. Differentiable Particle
          Filtering without Modifying the Forward Pass. _arXiv preprint
          arXiv:2106.10314_, 2021. https://arxiv.org/abs/2106.10314
      """
      self._propose_and_update_log_weights_fn = (
          propose_and_update_log_weights_fn
      )
      self._resample_fn = resample_fn
      self._resample_criterion_fn = resample_criterion_fn
      self._unbiased_gradients = unbiased_gradients
      self._particles_dim = particles_dim
      self._name = name or "SequentialMonteCarlo"
  
imports: import collections
  import tensorflow.compat.v2
  from tensorflow_probability.python.experimental.mcmc import weighted_resampling
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.mcmc import kernel
  from tensorflow_probability.python.mcmc.internal import util
label_desc: Use image node_id 1 to create a new SequentialMonteCarlo object from inherited base classes: kernel_base with example: obj = SequentialMonteCarlo(propose_and_update_log_weights_fn, resample_fn, resample_criterion_fn, unbiased_gradients, particles_dim, name)