qiboteam / qibo

A full-stack framework for quantum computing.
https://qibo.science
Apache License 2.0
294 stars 60 forks source link

DBI tests are not correctly using the backend #1351

Closed Simone-Bordoni closed 4 months ago

Simone-Bordoni commented 5 months ago

In test_models_dbi.py and test_models_dbi_utils.py there are a some tests that are not using correctly the backend. For example in the test test_gradient_descent (test_models_dbi.py), when the function gradient_descent is called (line 248) the backend is not passed to the function. Using the default backend=None, the function _check_backend will set the default numpy backend. When correctly using the backend some errors appears. For example in line 133 of utils_dbr_strategies.py where the lines:

params_new = backend.cast(d_params, copy=True) params_new[i] += delta

Do not work with tensorflow (item assignment is not supported).

I am currently trying to fix the problem in #1276 however I nmay need some help as I don't know the DBI module.

marekgluza commented 5 months ago

Thank you Simone! We will be in the Qibo meeting today and are generally available

marekgluza commented 5 months ago

For reference this is the example @Simone-Bordoni pointed out https://github.com/qiboteam/qibo/pull/1276/files#diff-ec10d361480ef8690ac7c3842bfe278c9f961d36f4c30292644ed114ac2068e4 thanks