Hi,

Sometimes I think I would better go back to the high school like in this case where I fail to find the correct distance. The error is:

In this test A and P are identical [[1, 0], [1, 0]] so its dist = 0

N is [[0, 1], [0, 1]] and I summed up all the squared differences = 4

BUT with an alpha of 3 should be 1 to get the expected value: loss = 2 .

Can you help me?

Many thanks

JoanSitges

You’re missing `reduce_sum`

.

```
anchor = [[1, 0], [1, 0]]
positive = [[1, 0], [1, 0]]
negative = [[0, 1], [0, 1]]
alpha = 3
#look at the shapes here
pos_dist = [[0], [0]]
neg_dist = [[2], [2]]
basic_loss = [[0-2+3], [0-2+3]] = [[1], [1]]
# find the right way to invoke this function.
loss = reduce_sum([[max(1, 0)], [max(1, 0)]]) = 2
```

Hi @balaji.ambresh

Many thanks for your hint. At the end it drove me to the solution. Although I stumbled again in the next test case it was again a question of keeping the correct shape of the tensor.

Best regrads

Joansitges