Hi everyone,
I’m stuck on the TripletLoss implementation for C3W3 (Siamese Networks)
My implementation follows the assignment exactly:
**codes removed as it is part of the grade function codes and which assess your submission grader output. In case you encountered error or different output than expected, then post screenshot of the error or your output. Posting any codes related to graded assignment is considered direct violation of Code of Conduct. If Mentor wants to look at your code, then will ask you to send the codes by personal DM**
What I’ve tried:
-
reduce_sum→ values are 2x/4x too large (as expected) -
reduce_mean→ values are close but not exact (0.7267 vs 0.7035) -
Different masking strategies (>= vs >, handling empty rows)
-
Adding epsilon for division by zero
Key observation: The pattern got = expected / batch_size suggests the unit tests might be expecting reduce_mean, but the assignment explicitly says “reduce_sum” and the grader apparently expects sum.
Questions:
-
Has anyone encountered this exact ratio issue?
-
Is there a subtle bug in how I’m computing
closest_negativeormean_negativethat introduces an implicit division? -
Could the unit tests be outdated (expecting mean when they should expect sum)?
I’ve been through the forums and see conflicting reports about sum vs mean. Any insights would be greatly appreciated!