Thank you for the reply @Tom_Bromley

The problem with using a keras layer just for the circuit is that i cannot include the actual convolution function (pasted the code below) in the network

```
def quanv(image):
"""Convolves the input image with many applications of the same quantum circuit."""
out = np.zeros((14, 14, 4))
# Loop over the coordinates of the top-left pixel of 2X2 squares
for j in range(0, 28, 2):
for k in range(0, 28, 2):
# Process a squared 2x2 region of the image with a quantum circuit
q_results = circuit(
phi=[image[j, k, 0], image[j, k + 1, 0], image[j + 1, k, 0], image[j + 1, k + 1, 0]]
)
# Assign expectation values to different channels of the output pixel (j/2, k/2)
for c in range(4):
out[j // 2, k // 2, c] = q_results[c]
return out
```

i even tried including the circuit logic inside the convolution function to see if it works

```
def quanv(inputs, conv_params):
out = np.zeros((14, 14, 4))
# Loop over the coordinates of the top-left pixel of 2X2 squares
for j in range(0, 28, 2):
for k in range(0, 28, 2):
# Process a squared 2x2 region of the image with a quantum circuit
win=[inputs[j, k, 0], inputs[j, k + 1, 0], inputs[j + 1, k, 0], inputs[j + 1, k + 1, 0]]
for j in range(4):
qml.RY(np.pi * win[j], wires=j)
RandomLayers(conv_params, wires=list(range(4)))
q_results = [qml.expval(qml.PauliZ(j)) for j in range(4)]
# Assign expectation values to different channels of the output pixel (j/2, k/2)
for c in range(4):
out[j // 2, k // 2, c] = q_results[c]
return out
```

there may be some issues with the array shapes but this is a rough sketch of what iâm trying to do. Iâm probably going wrong in many place please do let me know