Skip to content

Fix np.shuffle and wrong return type in searchspace samplers - #400

Merged
fjwillemsen merged 2 commits into
KernelTuner:masterfrom
AntonOresten:shuffle-fix
Sep 8, 2026
Merged

Fix np.shuffle and wrong return type in searchspace samplers#400
fjwillemsen merged 2 commits into
KernelTuner:masterfrom
AntonOresten:shuffle-fix

Conversation

@AntonOresten

Copy link
Copy Markdown
Contributor

get_distributed_random_sample_indices and get_LHS_sample_indices called the non-existent np.shuffle when num_samples == size, raising AttributeError. The distributed sampler also returned param-config tuples instead of indices when the random pool covered the whole searchspace.

Replaced with np.random.permutation(size).tolist() and get_random_sample_indices(num_samples).tolist(), and added test cases for the num_samples == size and num_samples > size paths, which were previously uncovered.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@fjwillemsen fjwillemsen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@AntonOresten thank you for your excellent contribution to fix this corner case and preventing it from occurring in the future!

@fjwillemsen
fjwillemsen merged commit 9a5961e into KernelTuner:master Sep 8, 2026
4 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.

2 participants