I realised this seems to be the formula that works for the unit tests:
loss = tf.reduce_sum(tf.maximum(basic_loss, 0.0), axis=None)
However, this seems to be comparing the values of each channel against 0 and returning the maximum.
I’d have expected the loss to be the maximum between basic_loss sum of all channels and 0.
loss = tf.maximum(tf.reduce_sum(basic_loss, 0.0), axis=None)
Please can anyone explain why it’s so?
Thanks
The sum of the maximums is not the same thing as the maximum of the sums, right? Those are two different things altogether. It just depends on what the mathematical definition is. The purpose of taking the max first is to eliminate negative values, right? Then you add up the results. That’s what the formula shown in the instructions says mathematically. Your job is to translate that into TF code …
Thank you, I guess I had a wrong understanding of the formula in that case. I didn’t get the part where we had to remove all negative values before summing up.
Thanks once again for your time.
Yes, it’s kind of subtle but check the little note right below the formula which explains what the little “+” subscript in the formula means.
1 Like
I see it now, thanks. It sure does make sense to remove negative values from the channels also.