torchquantum icon indicating copy to clipboard operation
torchquantum copied to clipboard

x Doesn't Seem to Change in MNIST Example

Open egoetz opened this issue 6 months ago • 0 comments

I was surprised to find out that the mnist example took in images (referred to as x in the QFCModel code) with a [256, 16] format, where 256 is the batch size and 16 is the shrunken then flattened MNIST image. Why does the quantum circuit take in its examples in [1, 16] format? And how can the gates process this format if they are limited to four wires? Is every element in a given image vector fed in on the same wire or is the image truncated to the first row of its pixels?

I tried to figure out exactly how the gates were processing these images. But when I went to try and print out any changes to the input x as it progressed through encoding and the quantum layer, torch.all(torch.eq(x, old_x)) always returned true. Is x not processed until we call the measure method? If not, how do I correctly evaluate change in-between simulation steps?

egoetz avatar Aug 08 '24 18:08 egoetz