I can get triplet loss programming assignment to work by calling reduce_sum with axis = -1 when calculating positive distance.
When I tried reduce_sum with axis = 1 which I think to be equivalent to axis = -1 since input tensor to reduce_sum is 2 dim of shape (3,128) so when setting axis =1 it should sum along columns (horizontally). However, I got this error
“InvalidArgumentError: Invalid reduction dimension (1 for input with 1 dimension(s) [Op:Sum]”
I wondered why reduce_sum with axis = 1 did not work in this case.
Setting axis=0, also did not work obviously because it sums along row and result in 128 instead of 3 (m # of samples)