# Face\_Recognition\_Exercise 1 - triplet\_loss

**URL:** <https://community.deeplearning.ai/t/face-recognition-exercise-1-triplet-loss/546432>\
**Category:** Convolutional Neural Networks\
**Tags:** week-module-4, coursera-platform\
**Created:** [January 16, 2024, 8:33pm UTC](https://community.deeplearning.ai/t/face-recognition-exercise-1-triplet-loss/546432 "2024-01-16T20:33:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vemula\_suman](https://avatars.discourse-cdn.com/v4/letter/v/da6949/32.png) [@vemula\_suman](https://community.deeplearning.ai/u/vemula_suman)\
**Post date:** [January 16, 2024, 8:33pm UTC](https://community.deeplearning.ai/t/face-recognition-exercise-1-triplet-loss/546432/1 "2024-01-16T20:33:43Z")

</div>

hi I am getting below error ,please help me to resolve.

 ![image](https://global.discourse-cdn.com/dlai/original/3X/c/a/ca4d592b957dc0a8d698a388554b365b4a924a05.png)

Thank you

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [January 16, 2024, 10:18pm UTC](https://community.deeplearning.ai/t/face-recognition-exercise-1-triplet-loss/546432/2 "2024-01-16T22:18:23Z")

</div>

Interesting. Well, if you print the types of `anchor` and `positive`, it turns out there are a number of different test cases: in some of them they are TF tensors and in others they are lists.

When I wrote this code I used `tf.subtract` instead of “-” and` tf.square` instead of \*\*2 and I did not encounter the error you are seeing. Apparently `tf.subtract` can coerce the lists to tensors, but the overloaded “-” operator does not work that way. The “overloading” logic in that case apparently doesn’t know how to subtract lists.

---

<div class="post-metadata">

**Author:** ![vemula\_suman](https://avatars.discourse-cdn.com/v4/letter/v/da6949/32.png) [@vemula\_suman](https://community.deeplearning.ai/u/vemula_suman)\
**Post date:** [January 17, 2024, 6:10am UTC](https://community.deeplearning.ai/t/face-recognition-exercise-1-triplet-loss/546432/3 "2024-01-17T06:10:40Z")

</div>

Thank you sir ,got soluttion
