-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix random number generator seed argument for quantum_volume #14586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
One or more of the following people are relevant to this code:
|
The `seed` argument to `quantum_volume` being a `numpy.random.Generator` resulted in `integers` being called with 0 for the `low` argument. When called with only a `low` argument like this, this value is taken as one more than the maximum and 0 is treated as the minimum. This resulted in a `TypeError` because the range is from 0 to -1. Here the handling of `Generator` was updated to match how the deprecated `QuantumVolume` class handled `seed` (which was slightly odd -- it caps the range at the int64 limit even though the argument is a `u64` in the Rust function -- but probably fine; keeping the range helps keep the behavior consistent between `QuantumVolume` and `quantum_volume` for a generator with the same seed).
Pull Request Test Coverage Report for Build 15617205136Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
@Mergifyio backport stable/1.4 stable/2.0 stable/2.1 |
✅ Backports have been created
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, this is a straightforward fix thanks for catching and fixing this
* Fix random number generator seed argument for quantum_volume The `seed` argument to `quantum_volume` being a `numpy.random.Generator` resulted in `integers` being called with 0 for the `low` argument. When called with only a `low` argument like this, this value is taken as one more than the maximum and 0 is treated as the minimum. This resulted in a `TypeError` because the range is from 0 to -1. Here the handling of `Generator` was updated to match how the deprecated `QuantumVolume` class handled `seed` (which was slightly odd -- it caps the range at the int64 limit even though the argument is a `u64` in the Rust function -- but probably fine; keeping the range helps keep the behavior consistent between `QuantumVolume` and `quantum_volume` for a generator with the same seed). * Address pylint's misunderstanding of the test import (cherry picked from commit ba74b5c)
* Fix random number generator seed argument for quantum_volume The `seed` argument to `quantum_volume` being a `numpy.random.Generator` resulted in `integers` being called with 0 for the `low` argument. When called with only a `low` argument like this, this value is taken as one more than the maximum and 0 is treated as the minimum. This resulted in a `TypeError` because the range is from 0 to -1. Here the handling of `Generator` was updated to match how the deprecated `QuantumVolume` class handled `seed` (which was slightly odd -- it caps the range at the int64 limit even though the argument is a `u64` in the Rust function -- but probably fine; keeping the range helps keep the behavior consistent between `QuantumVolume` and `quantum_volume` for a generator with the same seed). * Address pylint's misunderstanding of the test import (cherry picked from commit ba74b5c)
* Fix random number generator seed argument for quantum_volume The `seed` argument to `quantum_volume` being a `numpy.random.Generator` resulted in `integers` being called with 0 for the `low` argument. When called with only a `low` argument like this, this value is taken as one more than the maximum and 0 is treated as the minimum. This resulted in a `TypeError` because the range is from 0 to -1. Here the handling of `Generator` was updated to match how the deprecated `QuantumVolume` class handled `seed` (which was slightly odd -- it caps the range at the int64 limit even though the argument is a `u64` in the Rust function -- but probably fine; keeping the range helps keep the behavior consistent between `QuantumVolume` and `quantum_volume` for a generator with the same seed). * Address pylint's misunderstanding of the test import (cherry picked from commit ba74b5c)
…#14592) * Fix random number generator seed argument for quantum_volume The `seed` argument to `quantum_volume` being a `numpy.random.Generator` resulted in `integers` being called with 0 for the `low` argument. When called with only a `low` argument like this, this value is taken as one more than the maximum and 0 is treated as the minimum. This resulted in a `TypeError` because the range is from 0 to -1. Here the handling of `Generator` was updated to match how the deprecated `QuantumVolume` class handled `seed` (which was slightly odd -- it caps the range at the int64 limit even though the argument is a `u64` in the Rust function -- but probably fine; keeping the range helps keep the behavior consistent between `QuantumVolume` and `quantum_volume` for a generator with the same seed). * Address pylint's misunderstanding of the test import (cherry picked from commit ba74b5c) Co-authored-by: Will Shanks <willshanks@us.ibm.com>
…#14591) * Fix random number generator seed argument for quantum_volume The `seed` argument to `quantum_volume` being a `numpy.random.Generator` resulted in `integers` being called with 0 for the `low` argument. When called with only a `low` argument like this, this value is taken as one more than the maximum and 0 is treated as the minimum. This resulted in a `TypeError` because the range is from 0 to -1. Here the handling of `Generator` was updated to match how the deprecated `QuantumVolume` class handled `seed` (which was slightly odd -- it caps the range at the int64 limit even though the argument is a `u64` in the Rust function -- but probably fine; keeping the range helps keep the behavior consistent between `QuantumVolume` and `quantum_volume` for a generator with the same seed). * Address pylint's misunderstanding of the test import (cherry picked from commit ba74b5c) Co-authored-by: Will Shanks <willshanks@us.ibm.com>
…#14590) * Fix random number generator seed argument for quantum_volume The `seed` argument to `quantum_volume` being a `numpy.random.Generator` resulted in `integers` being called with 0 for the `low` argument. When called with only a `low` argument like this, this value is taken as one more than the maximum and 0 is treated as the minimum. This resulted in a `TypeError` because the range is from 0 to -1. Here the handling of `Generator` was updated to match how the deprecated `QuantumVolume` class handled `seed` (which was slightly odd -- it caps the range at the int64 limit even though the argument is a `u64` in the Rust function -- but probably fine; keeping the range helps keep the behavior consistent between `QuantumVolume` and `quantum_volume` for a generator with the same seed). * Address pylint's misunderstanding of the test import (cherry picked from commit ba74b5c) Co-authored-by: Will Shanks <willshanks@us.ibm.com>
The
seed
argument toquantum_volume
being anumpy.random.Generator
resulted inintegers
being called with 0 for thelow
argument. When called with only alow
argument like this, this value is taken as one more than the maximum and 0 is treated as the minimum. This resulted in aTypeError
because the range is from 0 to -1. Here the handling ofGenerator
was updated to match how the deprecatedQuantumVolume
class handledseed
(which was slightly odd -- it caps the range at the int64 limit even though the argument is au64
in the Rust function -- but probably fine; keeping the range helps keep the behavior consistent betweenQuantumVolume
andquantum_volume
for a generator with the same seed).