core/ops/array: implement set_symbols on DynSlice and Topk#2344
Merged
Conversation
kali
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DynSliceandTopkeach carry aTDimfield (lenandfallback_krespectively) that needs to ride the chunk-symbol substitution that pulse mode performs (STREAM → S · pulse). Without aset_symbolsimpl on these ops, the default trait method clones the op verbatim and theTDimfield stays referring to the old symbol, leaving the post-substitution model inconsistent.This commit hand-rolls
set_symbolson both ops, following the existingSlice/Tilepattern: build a fresh op withsubstitute_all(subs)?applied to the TDim fields, thenwire_nodeit into the target.Scope
Standalone, no behavior change for models that don't go through pulse-mode substitution. Extracted from the broader Scan body fact management work (#2337) so it can land independently.
Test
All existing
tract-core(245) tests pass.