tensorflow / tensorflow/probability

Avoid creating new computation nodes in `kernel_results` from MCMC kernels

Open
#498 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

The one_step method of some MCMC kernels seem to return a kernel_result that contains new computation nodes.

If I run the following loop in graph mode, I would create new computation nodes in every iteration.

  1. boot strap and get "kernel result 0"
  2. Use "kernel result 0" to run the one_step method to get "kernel result 1"
  3. Use "kernel result 1" to run the one_step method to get "kernel result 2"
    ...

How to avoid that?

permalink

      return result_state, NUTSKernelResults(
          next_.target_log_prob, next_.grads_target_log_prob,
          leapfrogs_taken + new_leapfrogs,
          leapfrogs_computed + tf.math.reduce_max(input_tensor=new_leapfrogs))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tensorflow_probability/python/experimental/mcmc/nuts.py at the linked line, then trace how one_step constructs and returns NUTSKernelResults in graph mode. Reproduce the iterative loop and determine what behavior the existing MCMC tests establish; done means repeated one_step calls do not create new computation nodes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.