How to pass a sample to a loss function?

I have a keras model where each sample consists of 3 scalars and 2 matrices. One of the matrices is a mask. I need a mean squared loss function that looks like (Y_hat * mask - Y)^2, where the multiplication is point wise. Each sample will have its own mask. How do I make this mask available to the loss function?

Hi maybe you could pre compute the Y_hat*mask value using the multiply function of numpy and pass that to value the mse loss function. Hope it helps

Hi @Bob_Zigon, you want to create your own loss function and pass the sample or you want to use pre define one ?