Skip to content

Comments

Add unit tests for remove_inputs in InputObserver#423

Merged
xadupre merged 2 commits intoremovifrom
copilot/sub-pr-422
Feb 23, 2026
Merged

Add unit tests for remove_inputs in InputObserver#423
xadupre merged 2 commits intoremovifrom
copilot/sub-pr-422

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

remove_inputs was added to InputObserver, InputObserverInfo, and InputCandidate but had no test coverage.

Changes

  • test_remove_inputs_kwargs: Verifies removing a single kwarg ("z") propagates correctly through infer_dynamic_shapes() and infer_arguments().
  • test_remove_inputs_multiple_kwargs: Verifies removing multiple kwargs ("z", "w") at once leaves remaining inputs ("x", "y") intact and correctly shaped.
observer = InputObserver()
with observer(model):
    for kwargs in inputs:
        model(**kwargs)  # model(x, y, z=None, w=None)

observer.remove_inputs(["z", "w"])

ds = observer.infer_dynamic_shapes()
# {"x": {0: DYNAMIC, 1: DYNAMIC}, "y": {1: DYNAMIC}}  — z and w absent

args = observer.infer_arguments()
# {"x": tensor(...), "y": tensor(...)}  — z and w absent

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Copilot AI changed the title [WIP] Add remove_inputs to InputObserver Add unit tests for remove_inputs in InputObserver Feb 23, 2026
Copilot AI requested a review from xadupre February 23, 2026 15:32
@xadupre xadupre marked this pull request as ready for review February 23, 2026 16:08
@xadupre xadupre merged commit 795fc3b into removi Feb 23, 2026
5 of 29 checks passed
sdpython pushed a commit that referenced this pull request Feb 24, 2026
* add remove_inputs to InputObserver

* changes

* mypy

* Add unit tests for `remove_inputs` in `InputObserver` (#423)

* Initial plan

* Add unit tests for remove_inputs in InputObserver

Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>

* a few fixes

* Update onnx_diagnostic/investigate/input_observer.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix

* style

* update doc

* fix documentation

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

2 participants