Hi,
The problem is that some of the parameters you give the optimizer do not require gradients, and so he don’t know how to handle them.
You can fix this using the ifilter method from python itertools package:
parameters = ifilter(lambda p: p.requires_grad, net.parameters())