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

Add support for offset in qml.MPS template #4531

Merged
merged 24 commits into from
Sep 13, 2023
Merged

Conversation

obliviateandsurrender
Copy link
Contributor

Context: qml.MPS allows users to create MPS circuits according to the paper Towards Quantum Machine Learning with Tensor Networks. But users would like to have more flexibility in controlling the tensor-network connectivity.

Description of the Change: Adds a new keyword argument offset that allows users to change position of subsequent block from the standard n_block_wires/2

Benefits: Makes the template more flexible

Possible Drawbacks: N/A

Related GitHub Issues: Forum Discussion

@obliviateandsurrender
Copy link
Contributor Author

[sc-37759]

@codecov
Copy link

codecov bot commented Aug 28, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (edf6c12) 99.64% compared to head (1bf0dee) 99.64%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4531   +/-   ##
=======================================
  Coverage   99.64%   99.64%           
=======================================
  Files         376      376           
  Lines       33238    33249   +11     
=======================================
+ Hits        33119    33130   +11     
  Misses        119      119           
Files Changed Coverage Δ
pennylane/templates/tensornetworks/mps.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@DSGuala DSGuala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nice improvement of qml.MPS 🚀 🚀

pennylane/templates/tensornetworks/mps.py Outdated Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Outdated Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Outdated Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Outdated Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Outdated Show resolved Hide resolved
tests/templates/test_tensornetworks/test_MPS.py Outdated Show resolved Hide resolved
tests/templates/test_tensornetworks/test_MPS.py Outdated Show resolved Hide resolved
Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pennylane/templates/tensornetworks/mps.py Outdated Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Outdated Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Outdated Show resolved Hide resolved
Copy link
Contributor

@DSGuala DSGuala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Approved as soon as the merge conflict are resolves 👍

pennylane/templates/tensornetworks/mps.py Outdated Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Show resolved Hide resolved
Copy link
Contributor

@timmysilv timmysilv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few nitpicks but it all looks great! 🎉 if you can make the _unflatten code work without upsetting pylint by just creating an op normally, that would be cool 😎 if not, no worries

doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Outdated Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Outdated Show resolved Hide resolved
pennylane/templates/tensornetworks/mps.py Show resolved Hide resolved
@obliviateandsurrender obliviateandsurrender merged commit 6ca294c into master Sep 13, 2023
39 checks passed
mudit2812 pushed a commit that referenced this pull request Sep 15, 2023
**Context:** `qml.MPS` allows users to create MPS circuits according to
the paper [Towards Quantum Machine Learning with Tensor
Networks](https://arxiv.org/abs/1803.11537). But users would like to
have more flexibility in controlling the tensor-network connectivity.

**Description of the Change:** Adds a new keyword argument `offset` that
allows users to change position of subsequent block from the standard
`n_block_wires/2`

**Benefits:** Makes the template more flexible

**Possible Drawbacks:** N/A

**Related GitHub Issues:** [Forum
Discussion](https://discuss.pennylane.ai/t/qml-mps-offset-control/2890)
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.

None yet

4 participants