Thank you, that works. But I was looking for the derivative with respect to the weights dY/dw_i. I have since found the answer to this from another post I believe as follows:
for f in pars[0]:
print(‘data is’)
print(f.data)
print(‘grad is’)
print(f.grad)
Please correct me if this is wrong…