Hi,
What torch.no_grad() means is that no gradients will be computed through any operations inside it.
In your case, if you want gradients to flow back to conv1, then you actually want to compute the gradients through costumefunction.
What are you trying to achieve here?