Fixed Convolution in Loss Function

Hi Guys,

I have a seemingly simple problem. I wish to implement a loss function that contains a fixed convolution. That is if X is my input image and Y = f(X) is the output of my CNN, I wish to minimize ||A*Y||. where A is a fixed convolution operation (say a derivative filter). What is the easiest way to implement this?

Thanks
Gautam

You can just make a Python function out of it, and then use it to compute loss:

def loss(output):
    return || A * output ||  # Replace this with your convolution

The optimizers will attempt to minimize your loss. I hope this helps.