Skip to content

Update RandomLayers template to support new graph-based decomposition #8711

@comp-phys-marc

Description

@comp-phys-marc

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,

  1. Implement RandomLayers current decomposition as a stand-alone function.
  2. 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.
  3. Register the new decomposition with the RandomLayers template.
  4. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions