# Face \_Recognition

**URL:** <https://community.deeplearning.ai/t/face-recognition/25427>\
**Category:** Convolutional Neural Networks\
**Tags:** coursera-platform\
**Created:** [August 5, 2021, 7:34pm UTC](https://community.deeplearning.ai/t/face-recognition/25427 "2021-08-05T19:34:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ano\_11](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/ano_11/32/131645_2.png) [@ano\_11](https://community.deeplearning.ai/u/ano_11)\
**Post date:** [August 5, 2021, 7:34pm UTC](https://community.deeplearning.ai/t/face-recognition/25427/1 "2021-08-05T19:34:57Z")

</div>

What is the error here?

## loss = tf.Tensor(527.2598, shape=(), dtype=float32)

TypeError Traceback (most recent call last)  
 in   
11  
12 y\_pred\_perfect = ([1., 1.], [1., 1.], [1., 1.,])  
—\> 13 loss = triplet\_loss(y\_true, y\_pred\_perfect, 5)  
14 assert loss == 5, “Wrong value. Did you add the alpha to basic\_loss?”  
15 y\_pred\_perfect = ([1., 1.],[1., 1.], [0., 0.,])

in triplet\_loss(y\_true, y\_pred, alpha)  
22 #(≈ 4 lines)  
23 # Step 1: Compute the (encoding) distance between the anchor and the positive  
—\> 24 pos\_dist = tf.reduce\_sum(tf.square(anchor - positive), axis = -1)  
25 # Step 2: Compute the (encoding) distance between the anchor and the negative  
26 neg\_dist = tf.reduce\_sum(tf.square(anchor - negative), axis = -1)

TypeError: unsupported operand type(s) for -: ‘list’ and ‘list’

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [August 6, 2021, 12:10am UTC](https://community.deeplearning.ai/t/face-recognition/25427/2 "2021-08-06T00:10:02Z")

</div>

The error suggests that subtracting two lists “(anchor - positive)” is not allowed in python.  
Try the “tf.subtract()” function instead.
