Hi, As MeanSquaredLossLayer did not seem a suitable LossFunction for my network, I wanted to try other LossFunctions. The documentation says that you can use 'any network with an "Input" and optional "Target" port' as a LossFunction, but it was not clear to me how I can create a network that calculates a custom LossFunction. MeanSquaredLossLayer accepts two Array input ports and produces one Real output port, I guess it does something like
Total[(#1-#2)^2]/Length[#1]
I looked at ThreadingLayer, it accepts two Array input ports but produces an Array output port, so I expected I could not use it as a LossFunction. But when I specify
LossFunction->ThreadingLayer[(#1 - #2)^2 &, InputPorts -> {"Input", "Target"}]
I do not get an error and the loss seams similar to what I get with MeanSquaredLossLayer, so this suggests that ThreadingLayer can be used for custom LossFunctions. Any idea why this works? 'What' turns the Array output of ThreadingLayer into a Real output?
Thanks, GW