Don’t use weight.data.fill_ here. Anything you use going through the .data attribute won’t be backpropagated.
I’d recommend writing it using the torch.nn.functional interface:
import torch.nn.functional as F
p = F.conv2d(image, weight=network_output, ...)

See torch.nn.functional.conv2d 11
If you used a the nn.Conv2d module, you would need to change the weight attribute every forward pass:
fliter = nn.Conv2d(...)
filter.weight = network_output
p = filter(image)