pymc-devs / pymc-devs/pytensor

Add support for multiple output functions to `gradient.verify_grad`

Open
#644 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature request gradients
Dominant language
Python
Stars
644
Forks
208
Avg merge
2d 14h
Merged PRs (30d)
16

Description

Description

This is marked as a to-do in the code, along with a suggestion of how to handle it.

The whole function could probably be cleaned up while we're at it. It's not easy to read because it's doing so much all in a single function. It would be better to split up the construction of the tests from their execution. This would make extending to multiple outputs very straightforward -- just add one more outer loop.

I don't know how we feel about another dependency, but farming out the actual numerical gradients to a specialized package like numdifftools might be good too.

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 in pytensor/gradient.py at the verify_grad TODO around line 1791 and read the existing function. Separate test construction from execution as suggested, then extend the behavior so multiple output functions are verified; the optional numdifftools dependency is an open design question.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.