Important Note
⚠️ This issue is part of an internal assignment and not meant for external contributors.
Context
PennyLane has a new opt-in graph-based decomposition system that improves upon it's legacy counterpart by allowing operators to define multiple custom decomposition. As part of this effort, operators and templates are slowly being migrated to support this new system.
The RandomLayers template needs to be migrated to support the new system.
Implementation
The selection of a decomposition is driven by its resource cost, which is currently a direct measure of the number of gates required. At a high-level, migrating an operator or template to the new system requires the following,
- Implement
RandomLayers current decomposition as a stand-alone function.
- Calculate the correct amount of resources required (based on it's decomposition algorithm) and register it to the function. With this being a stochastic template, the resources can be calculated to be the worst case scenario.
- Register the new decomposition with the
RandomLayers template.
- Add testing to ensure feature parity with the legacy system.
Relevant Documentation
Relevant Examples
Some examples of similar graph decompositions can be found in the following closed PRs:
Additional Requirements
A completed PR would:
- Use
_test_decomposition_rule to validate the new decomposition rule added.
- Pass all tests (with 100% test coverage for the patch).
- Pass all formatting (black and pylint) and documentation checks.
- Include a changelog entry at
doc/releases/changelog-dev.md (make sure to include your name in the list of contributors at the bottom).
Important Note
Context
PennyLane has a new opt-in graph-based decomposition system that improves upon it's legacy counterpart by allowing operators to define multiple custom decomposition. As part of this effort, operators and templates are slowly being migrated to support this new system.
The
RandomLayerstemplate needs to be migrated to support the new system.Implementation
The selection of a decomposition is driven by its resource cost, which is currently a direct measure of the number of gates required. At a high-level, migrating an operator or template to the new system requires the following,
RandomLayerscurrent decomposition as a stand-alone function.RandomLayerstemplate.Relevant Documentation
Relevant Examples
Some examples of similar graph decompositions can be found in the following closed PRs:
Additional Requirements
A completed PR would:
_test_decomposition_ruleto validate the new decomposition rule added.doc/releases/changelog-dev.md(make sure to include your name in the list of contributors at the bottom).