Backpropagation with Pytorch

I have run a similar experiment on Tensorflow. I basically followed a tutorial (انتقال یادگیری و تنظیم دقیق  |  TensorFlow Core) because I am not familiar with TF. I modified it to use ResNet50.

(For each I give the time for ‘lightning.qubit’ and ‘default.qubit’ respectively)

Using ‘adjoint’ as the differentiation method, I observed 11s and 12s.

Using ‘backprop’, I observed 35s and 34s

As a reference, using ‘finite-diff’ I observed 17s and 26s.

It is interesting to see backprop being slower than finite-difference in this case. Is there any reason for that?

I have attached my code in case any results are a mistake on my behalf.

The python file was run using a GTX 1080. tf_exp.py (3.7 KB)