tensorflow / tensorflow/probability

[oryx] harvest after grad

Open
#1,045 8 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

Hi tensorflow probability team!

I was using the oryx library that is maintained in this repo, following an issue from JAX https://github.com/google/jax/issues/3936#issuecomment-668954244.

I am wondering if there is a way to harvest/reap with a grad nested inside, and get the gradient values instead of the primal values. e.g.

import oryx
reap = oryx.core.reap
sow = oryx.core.sow

def f(x): 
  return sow(x ** 3, tag="test", name="x3") + 1

print(reap(grad(f),  tag="test"))
# out: {'x3': DeviceArray(1., dtype=float32)}
# how can we get (something similar to) {'x3': DeviceArray(3., dtype=float32)} ?

Will nest help here?

Thanks!

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 the Oryx reap/sow and grad example in the issue, then investigate whether nested transformations can expose gradient values rather than primal values. Done means determining whether this behavior is supported and, if not, documenting the required API or implementation scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Feature
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.