Skip to content

docs(cfm): fix compute_conditional_flow docstring formula (t -> xt in numerator)#179

Merged
atong01 merged 1 commit into
atong01:mainfrom
MukundaKatta:codex/fix-compute-conditional-flow-docstring
Apr 20, 2026
Merged

docs(cfm): fix compute_conditional_flow docstring formula (t -> xt in numerator)#179
atong01 merged 1 commit into
atong01:mainfrom
MukundaKatta:codex/fix-compute-conditional-flow-docstring

Conversation

@MukundaKatta
Copy link
Copy Markdown
Contributor

@MukundaKatta MukundaKatta commented Apr 20, 2026

Summary

`TargetConditionalFlowMatcher.compute_conditional_flow` (`torchcfm/conditional_flow_matching.py`, lines 370-394) documents the target conditional flow as:

```
ut(x1|x0) = (x1 - (1 - sigma) t)/(1 - (1 - sigma)t)
```

but the implementation returns:

```python
return (x1 - (1 - self.sigma) * xt) / (1 - (1 - self.sigma) * t)
```

which matches Eq.(21) of Lipman et al., ICLR 2023 — the numerator uses the position `xt`, not the time scalar `t`. Updated the summary (line 372) and the Returns description (line 386) so both say:

```
ut(x1|x0) = (x1 - (1 - sigma) xt)/(1 - (1 - sigma)t)
```

Closes #175

Testing

Docstring-only change; no runtime paths touched.

Summary by Sourcery

Documentation:

  • Fix the compute_conditional_flow docstring formula so the numerator uses xt instead of t, aligning documentation with the implementation and Eq.(21) of Lipman et al., ICLR 2023.

… numerator)

The docstring claims ut(x1|x0) = (x1 - (1 - sigma) t)/(1 - (1 - sigma)t),
but the implementation at line 394 returns
  (x1 - (1 - sigma) * xt) / (1 - (1 - sigma) * t)
which matches Eq.(21) in Lipman et al. (ICLR 2023). Update the docstring
summary and the Returns description so the numerator uses xt.

Closes atong01#175
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 20, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR corrects the docstring formula for TargetConditionalFlowMatcher.compute_conditional_flow so that it matches the actual implementation and the referenced paper, replacing an incorrect use of t in the numerator with xt in both the summary line and the Returns section.

File-Level Changes

Change Details Files
Align the compute_conditional_flow docstring formula with the implemented equation and Lipman et al. Eq.(21).
  • Update the docstring one-line summary to use xt instead of t in the conditional vector field numerator.
  • Update the Returns description to use xt instead of t in the conditional vector field numerator, keeping the denominator unchanged.
torchcfm/conditional_flow_matching.py

Assessment against linked issues

Issue Objective Addressed Explanation
#175 Correct the compute_conditional_flow docstring so that the conditional vector field formula uses the position xt (x) in the numerator instead of the time scalar t, matching Eq.(21) and the implementation.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@atong01
Copy link
Copy Markdown
Owner

atong01 commented Apr 20, 2026

Thanks for the PR!

@atong01 atong01 merged commit b4f9dcb into atong01:main Apr 20, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typo in comment: wrong formula in compute_conditional_flow docstring (line ~372)

2 participants