tensorflow / tensorflow/probability

Feature request: Computing gradients wrt op 'Placeholder' inside while loop

Open
#462 7 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

I am using the BFGS optimizer and the used loss if a function of gradients with respect to a Placeholder. I am running into this problem:

ValueError: Cannot compute gradient inside while loop with respect to op 'Placeholder'. We do not support taking the gradient wrt or through the initial value of a loop variable. Gradients can be computed through loop invariants or wrt the input parameters to the loop body.

Could this be easily fixed?

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 by reproducing the reported ValueError with the BFGS optimizer and a loss that depends on gradients with respect to a Placeholder inside a while loop. Investigate the loop-gradient limitation described in the error; done means gradients can be computed for that case without breaking the existing supported loop-gradient behavior.

Written by the indexing model from the issue text.

Assessment

Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.