Week 2. Why we use K.mean here?
Course Q&A
TensorFlow: Advanced Techniques Specialization
Custom Models, Layers and Loss Functions with TF
I don’t understand why we use K.mean in Contrastive Loss in class and don’t use in other places?
This is screen from video “Coding Contrastive Loss”
1 Like
It’s an interesting question. Notice that averaging is not being done in this fragment from the TensorFlow implementation…
return y_true * tf.math.square(y_pred) + (1.0 - y_true) * tf.math.square(
tf.math.maximum(margin - y_pred, 0.0)
It isn’t mentioned in the video?
The teacher skipped this line.
I did some research on this and it seems the instructor has mistaken that calculation with the RMSE calculation, seems to me. I will raise an issue in github so they can have a look at it as well.
1 Like