pennylane icon indicating copy to clipboard operation
pennylane copied to clipboard

Enable parameter broadcasting in embedding templates

Open dwierichs opened this issue 2 years ago • 2 comments

Here we introduce broadcasting to the embedding templates

  • AmplitudeEmbedding
  • AngleEmbedding
  • IQPEmbedding
  • QAOAEmbedding

For BasisEmbedding, detection of broadcasting based on hyperparameters instead of parameters would be required, which is not implemented yet. CV embeddings are not supported either, as there is not broadcasting implementation for CV devices.

In addition, there is a duplicate test file being removed in this PR.

Related issues: #2804

dwierichs avatar Jul 13 '22 16:07 dwierichs

Hello. You may have forgotten to update the changelog! Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

github-actions[bot] avatar Jul 13 '22 16:07 github-actions[bot]

Codecov Report

Merging #2810 (c4a9728) into master (c874edc) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2810   +/-   ##
=======================================
  Coverage   99.65%   99.65%           
=======================================
  Files         261      261           
  Lines       22063    22092   +29     
=======================================
+ Hits        21986    22015   +29     
  Misses         77       77           
Impacted Files Coverage Δ
pennylane/ops/qubit/attributes.py 100.00% <ø> (ø)
pennylane/ops/qubit/state_preparation.py 100.00% <100.00%> (ø)
pennylane/templates/embeddings/amplitude.py 98.21% <100.00%> (+0.29%) :arrow_up:
pennylane/templates/embeddings/angle.py 100.00% <100.00%> (ø)
pennylane/templates/embeddings/iqp.py 100.00% <100.00%> (ø)
pennylane/templates/embeddings/qaoaembedding.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Jul 14 '22 11:07 codecov[bot]

Hey @antalszava

does it not work only with parameter broadcasting or does it not work with batch_params either? Has it worked before with the transform?

As commented in the respective file, batch_params does not currently work with AmplitudeEmbedding and Tensorflow.

Yep, I think it may have been deleted already by another PR in the meantime.

Yes, this one: #2873

dwierichs avatar Aug 18 '22 09:08 dwierichs