# How can I make this Quvolution Demo's convolutional layer trainable as well?

**URL:** <https://discuss.pennylane.ai/t/how-can-i-make-this-quvolution-demos-convolutional-layer-trainable-as-well/3814>\
**Category:** PennyLane Help\
**Created:** [December 15, 2023, 1:20pm UTC](https://discuss.pennylane.ai/t/how-can-i-make-this-quvolution-demos-convolutional-layer-trainable-as-well/3814 "2023-12-15T13:20:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RX1](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/rx1/32/698_2.png) [@RX1](https://discuss.pennylane.ai/u/RX1)\
**Post date:** [December 15, 2023, 1:20pm UTC](https://discuss.pennylane.ai/t/how-can-i-make-this-quvolution-demos-convolutional-layer-trainable-as-well/3814/1 "2023-12-15T13:20:05Z")

</div>

This is the demo:

> **[Quanvolutional Neural Networks | PennyLane Demos](https://pennylane.ai/qml/demos/tutorial_quanvolution/)**
>
> Train a quantum convolutional neural network to classify MNIST images.

The quantum convolution layer in this demo is not trained, i.e. the parameters are solidified, so how to make this quantum convolution layer trainable?

---

<div class="post-metadata">

**Author:** ![isaacdevlugt](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/isaacdevlugt/32/1159_2.png) [@isaacdevlugt](https://discuss.pennylane.ai/u/isaacdevlugt)\
**Post date:** [December 18, 2023, 3:50pm UTC](https://discuss.pennylane.ai/t/how-can-i-make-this-quvolution-demos-convolutional-layer-trainable-as-well/3814/2 "2023-12-18T15:50:33Z")

</div>

Hey @RX1,

You need to define some loss / cost function that is a measure of how close the model’s prediction is to the corresponding input image and optimize that. The parameters `rand_params` in `circuit` would be the things that get tuned to optimize the cost function. Check out our other QML demos to get a sense for how that works: [Quantum Machine Learning | PennyLane Demos](https://pennylane.ai/qml/demonstrations/quantum-machine-learning/) 🙂

Let me know if this helps!
