Skip to content
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

Fix backend pickle #581

Merged
merged 2 commits into from
May 10, 2022
Merged

Fix backend pickle #581

merged 2 commits into from
May 10, 2022

Conversation

stavros11
Copy link
Member

The following:

import qibo
import dill

qibo.set_backend("qibolab")
dill.dump_session("session.pkl")
dill.load_session("session.pkl")
qibo.set_backend("numpy")

namely changing the backend after loading a session from pickle fails with AttributeError. Here the __getitem__ and __setitem__ methods are update to pickle and load all the attributes of the Backend object to fix this issue.

@stavros11 stavros11 requested a review from scarrazza May 9, 2022 13:38
@codecov
Copy link

codecov bot commented May 9, 2022

Codecov Report

Merging #581 (b1a6110) into master (2deee67) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #581   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           86        86           
  Lines        12981     12989    +8     
=========================================
+ Hits         12981     12989    +8     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/qibo/backends/__init__.py 100.00% <100.00%> (ø)
src/qibo/tests/test_backends_init.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2deee67...b1a6110. Read the comment docs.

@scarrazza scarrazza merged commit cfef406 into master May 10, 2022
@stavros11 stavros11 deleted the fixpickle2 branch May 18, 2022 18:52
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