Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Sep 4, 2025

Summary

For a custom feature map with all parameters marked as trainable, one can run into self._num_features = 0 (because feature_map.num_parameters == _num_training_parameters), which then triggers _validate_inputs to detect x_vec.shape[1] != self._num_features; however, the ValueError mistakenly reports self._feature_map.num_parameters instead of self._num_features, making the real problem hard to debug. This update improves the error message to be self._num_features. Unittests do not need updating.

Details and comments

Fixes #932


This is an automatic backport of pull request #981 done by [Mergify](https://mergify.com).

@edoaltamura
Copy link
Collaborator

Note that #985 must be fixed to merge this PR.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 17612554236

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 90.656%

Totals Coverage Status
Change from base Build 16205641491: 0.02%
Covered Lines: 4366
Relevant Lines: 4816

💛 - Coveralls

@edoaltamura edoaltamura merged commit 05e8962 into stable/0.8 Sep 10, 2025
14 checks passed
@edoaltamura edoaltamura deleted the mergify/bp/stable/0.8/pr-981 branch September 10, 2025 12:34
edoaltamura added a commit that referenced this pull request Sep 10, 2025
…) (#988)

* Correct `self._num_features` in ValueError (#981)

(cherry picked from commit 56bbed0)

* Update copyright in `base_kernel.py`

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
edoaltamura added a commit that referenced this pull request Sep 10, 2025
)

* Correct output shape in `EstimatorQNN` tutorial (#982)

(cherry picked from commit 7b57913)

* Change `self._num_features` in ValueError message (backport #981) (#984) (#988)

* Correct `self._num_features` in ValueError (#981)

(cherry picked from commit 56bbed0)

* Update copyright in `base_kernel.py`

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

---------

Co-authored-by: Edoardo Altamura <38359901+edoaltamura@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@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.

3 participants