Closed bqth29 closed 4 months ago
Attention: Patch coverage is 98.61111%
with 1 lines
in your changes are missing coverage. Please review.
Project coverage is 99.93%. Comparing base (
54cf452
) to head (01b3802
).
Files | Patch % | Lines |
---|---|---|
src/simulated_bifurcation/check_dtype.py | 87.50% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
š¬ Pull Request Description
Based on #41, a reflexion was carried out regarding the difference between the models' dtype and the computation dtype.
Because the oscillators in the SB backend are in [-1, 1], the backend computation dtype must be a float. Besides, some key PyTorch methods are not available for
float16
so onlyfloat32
andfloat64
are considered.Thus, the core Ising model and the SB optimizer can only run on
float32
orfloat64
dtype, any other dtype will raise aValueError
.However,
QuadraticPolynomial
s can still be of any dtype. When such a polynomial is converted to an Ising model:QuadraticPolynomial
's dtype isfloat32
orfloat64
, this dtype is used for the equivalent Ising modelfloat32
dtype will be used for the Ising model by defaultOnce the optimal spins are retrieved by the polynomial at the end of the optimization and converted to integer values according to the optimization domain, the tensors are converted to the polynomial's dtype.
When passing the
dtype
parameter to thesb.maximize
/sb.minimize
functions, the dtype will be used as theQuadraticPolynomial
's dtype and by extension as the optimization dtype if the dtype id float (otherwise, it will befloat32
).Finally, for
Polynomial
s, if thedtype
and/ordevice
parameters are set to None, the default dtype and/or device of PyTorch will be used.āļø Check list
š New features
None.
š Bug fixes
None.
š£ Supplementary information
None.