A special loss function in caffe
<p>I have a kind of euclidean loss function which is:</p>

<pre><code>\sum_{i,j} c_i*max{0,y_{ji}-k_{ji}} + p_i*max{0,k_{ji}-y_{ji}}
</code></pre>

<p>which <code>y_{ji}</code> are the output of caffe and <code>k_{ji}</code> are the real output value, <code>i</code> is the index of the items and <code>j</code> is index of samples. </p>

<p>The issue is about getting the values of parameters <code>c_i</code> and <code>p_i</code>. </p>

<p>When I have <code>c_i = c_q for all i \neq q</code>, and similarly for <code>p_i</code>, I simply get the values of them as parameters of the loss layer (I added two new parameters in the caffe.proto). However, the problems is that now I have around 300 items so that it is not reasonable to get them as loss layer parameters. 
I tried to get their values in the loss layer, I mean I tried to add another <code>bottom layer</code> for loss layer, but it gave an error. 
I am stuck here!</p>

<p>Please guide me how I can solve this issue. </p>

<p>Thanks in advance,
Afshin</p>