question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Define custom positon for `qml.transforms.insert`

See original GitHub issue

Feature details

Currently, the insert transform supports three position settings, end, all and start. all and start will ignore state preparations. But this only applies to the templates already present in PennyLane. But we can have custom state preparation routines. It will be nice to have some way to mark our state preparation which is then not modified with the insert transform.

Also, only state preparations should be skipped, which come at the beginning of the circuit. Currently, if I add another template like StronglyEntanglingLayers somewhere in between, it is also skipped over by the transform. I don’t think this is the expected behaviour.

Implementation

State preparations can be asked to be made as a separate function (like a template) outside the circuit and then called from within. These will then have a specific argument or name instructing the transform to skip. A named argument seems like the better way. This can also be added to all templates. Users can then control if they want the transform to skip the template or not by marking it True or False.

How important would you say this feature is?

1: Not important. Would be nice to have.

Additional information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ankit27khcommented, Apr 4, 2022

Hi @trbromley,

For your second point, I want to note that MottonenStatePreparation is not being skipped (you can see the following BitFlip operations).

This is what I meant by skipping. The BitFlip operations are after the template gates and not inside the template. You can see the difference in the next example. There the BitFlip gates are after every gate of the template.

0reactions
CatalinaAlbornozcommented, Apr 4, 2022

Thanks for clarifying this @ankit27kh!

Read more comments on GitHub >

github_iconTop Results From Across the Web

qml.transforms.insert — PennyLane 0.27.0 documentation
Insert an operation into specified points in an input circuit. Circuits passed through this transform will be updated to have the operation, specified...
Read more >
Customizing Qt Quick Controls - Qt Documentation
In order to provide a custom look and feel, the default QML ... The first way to create this button is to simply...
Read more >
Introduction to Qt / QML (Part 09) - Custom Transformations
This video will feature an example of a custom visual transformation : we will create a very simple analog clock by rotating two...
Read more >
Introduction to Qt / QML (Part 08) - Item transformations
It's time to introduce the most basic visual transformations that you can apply to items in a Qt Quick scene. Any visual item...
Read more >
QML object property inside transform - Stack Overflow
The transform will recognize neither offsetx nor offsety , whereas the position properties x,y, which both depend on the offset properties, work ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found