Skip to content

fix(metrics): correct compute() return values to prevent ValueError crash#538

Open
Aamod-Dev wants to merge 1 commit into
kubeedge:mainfrom
Aamod-Dev:fix-metrics-compute-unpacking-bug
Open

fix(metrics): correct compute() return values to prevent ValueError crash#538
Aamod-Dev wants to merge 1 commit into
kubeedge:mainfrom
Aamod-Dev:fix-metrics-compute-unpacking-bug

Conversation

@Aamod-Dev

Copy link
Copy Markdown

What type of PR is this?
/kind bug

What this PR does / why we need it:
This PR fixes a bug in core/testcasecontroller/metrics/metrics.py that causes a ValueError: not enough values to unpack (expected 3, got 2) when running lifelong learning or incremental learning benchmarks with a malformed (non-square) task matrix.

Previously, when the compute() function detected a malformed matrix (flag=False), it returned a 2-tuple: (bwt_score, fwt_score). However, all callers of this function (e.g. bwt_func, fwt_func, matrix_func) unconditionally expect a 3-tuple (_, BWT_score, _ = compute(...)), resulting in an immediate crash.

This commit updates the error path of compute() to consistently return a 3-tuple (None, np.nan, np.nan) when flag=False, satisfying caller expectations.

Which issue(s) this PR fixes:
Fixes #531

Special notes for your reviewer:
N/A

@kubeedge-bot kubeedge-bot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 13, 2026
@kubeedge-bot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Aamod007
To complete the pull request process, please assign moorezheng after the PR has been reviewed.
You can assign the PR to them by writing /assign @moorezheng in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubeedge-bot

Copy link
Copy Markdown
Collaborator

Welcome @Aamod007! It looks like this is your first PR to kubeedge/ianvs 🎉

@kubeedge-bot kubeedge-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 13, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the compute function in core/testcasecontroller/metrics/metrics.py to return a 3-tuple (None, np.nan, np.nan) instead of a 2-tuple of np.nan values when the flag condition is not met. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Aamod-Dev

Copy link
Copy Markdown
Author

/assign @MooreZheng

…rash

Signed-off-by: Aamod007 <aamodkumar2006@gmail.com>
@Aamod-Dev Aamod-Dev force-pushed the fix-metrics-compute-unpacking-bug branch from c66359a to 020eb32 Compare June 15, 2026 05:17
@Aamod-Dev

Copy link
Copy Markdown
Author

/assign @jaypume

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] compute() returns 2 values on error but all callers unpack 3 — ValueError crash in BWT/FWT/Matrix metrics

4 participants