Skip to content

Introduce shaped output tensor accessor for named circuit outputs#212

Merged
HudsonGraeme merged 2 commits into
mainfrom
introduce/shaped-output-accessor
Jul 4, 2026
Merged

Introduce shaped output tensor accessor for named circuit outputs#212
HudsonGraeme merged 2 commits into
mainfrom
introduce/shaped-output-accessor

Conversation

@HudsonGraeme

@HudsonGraeme HudsonGraeme commented Jul 4, 2026

Copy link
Copy Markdown
Member

Named circuit outputs were only retrievable as one flattened vector, which is insufficient for consumers that need to compare a partial result against the matching region of the expected tensor: group split dispatch returns one group's output, and validating it requires slicing the expected tensor along the concatenation axis, which needs shape information. Adds an accessor returning the shaped arrays per requested name alongside the existing flattened form.

Summary by CodeRabbit

  • New Features
    • Added a new way to retrieve output tensors as arrays, making it easier to work with structured results directly.
    • Supports fetching multiple named outputs in one call and returns no result when no names are provided.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c676d5a5-7c8d-4fe4-bfb3-b050fd52bb93

📥 Commits

Reviewing files that changed from the base of the PR and between fd7f2a6 and 3baa79e.

📒 Files selected for processing (1)
  • crates/dsperse/src/pipeline/combined.rs

Walkthrough

Adds a new public method output_arrays_for_names to CombinedRun in combined.rs, which looks up requested tensor names in tensor_cache, clones matching results into ArrayD<f64> values, and returns None when the input names list is empty.

Changes

Tensor Array Output Lookup

Layer / File(s) Summary
Add output_arrays_for_names method
crates/dsperse/src/pipeline/combined.rs
New public method fetches tensors from tensor_cache by name, clones them as ArrayD<f64>, and returns None for empty input, Some(Vec) otherwise.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

  • inference-labs-inc/dsperse#157: Adds a similar CombinedRun helper (outputs_for_names) that looks up tensors by name from tensor_cache, but returns flattened Vec<f64> instead of ArrayD<f64>.

Poem

A rabbit hops through cached array trees,
Plucking tensors by name with gentle ease,
Cloning each shape into ArrayD form,
Empty names? None — that's the norm.
Hop, clone, return — a tidy little breeze! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: a new shaped tensor accessor for named circuit outputs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch introduce/shaped-output-accessor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@HudsonGraeme HudsonGraeme merged commit c746ea7 into main Jul 4, 2026
12 checks passed
@HudsonGraeme HudsonGraeme deleted the introduce/shaped-output-accessor branch July 4, 2026 02:38
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.

1 participant