Hi @andreamari

I wanna understand the role of Ry rotation in the quantum circuit as a convolutional operation. Ry rotation applied on data before encoding to quantum data?

thanks in advance.

# Quantum Convolutional Layer+ Random quantum circuit

Hey ZainabAli,

Could you add where the code is from? Iâ€™m just trying to understand in what context you are thinking of convolutions here.

Guessing from the comment in the code, `phi`

is a data vector and the `RY`

are just encoding the data into a quantum state (see also the AngleEmbedding template). Mathematically speaking I donâ€™t see an obvious convolution happening in the embedding. Typically, in convolutional neural net layers one slides a window through the data vector and summarises all entries in this window with some arithmetic operation. Here we just encode each entry into one qubit, which is a rather common approach.

But @andreamari, maybe you have more context?

Oh, I just saw!

@ZainabAli, in that case, youâ€™ll find that the convolution is happening through the `quanv()`

function defined just after the code you show.

Basically, the function performs the â€śslidingâ€ť, and collects the features (here squares of pixels in an image) into the vector `phi`

, which then gets fed to the quantum circuit via the `RY`

gates. So the quanvolution is a executed by a combination of classical and quantum computing.

Would that answer your question? @andreamari, feel free to chip in

Hi @Maria_Schuld

Thanks for your reply

Are rotations gates (Rx, Ry, Rz) used in encoding classical to quantum?

what is the difference between rotations gates and Quantum embedded methods (e.g Amplitude embedding, Basis embedding [ (https://pennylane.ai/qml/glossary/quantum_embedding.html#quantum-embedding) in the encoding phase?

the choice encoding method based on the type of data?

thanks @Maria_Schuld ! All you said is correct, I have nothing to add.

@ZainabAli, *angle embedding* (e.g. `RY(phi)`

on each qubit) is just one of the possible ways of embedding classical data in a quantum system. It is probably the simplest one from an experimental point of view since one only needs a single gate for each parameter.

Other methods such as *amplitude embedding* can in principle compress more data but are usually more difficult to implement.

In general it is not clear what is the best choice.

A nice aspect of PennyLane is that you can easily try and switch between different methods by importing the corresponding template from this list (https://pennylane.readthedocs.io/en/stable/code/qml_templates.html).

@andreamari

I can use Rx or Rz instead of Ry. I just want to know, How to choose the encoding method according to data(such as images or numerical data).

thanks

Yes, for angle encoding, you can use any rotation.

I donâ€™t have a simple answer about how to choose the encoding method according to data.

The only suggestion that comes to my mind is that, if you are dealing with images, this tutorial on *quantum transfer learning* could be a good trick for efficiently pre-processing and encoding features of images on quantum circuits. Similarly, in this this tutorial on *quantum embeddings* you can find a similar approach.

@Maria_Schuld and @andreamari

I am very grateful for your help.

many thanks.

@nathan, thanks a lot for you.