# C3W1 Log perplexity function

**URL:** <https://community.deeplearning.ai/t/c3w1-log-perplexity-function/687049>\
**Category:** NLP with Sequence Models\
**Tags:** week-module-1\
**Created:** [September 3, 2024, 6:35am UTC](https://community.deeplearning.ai/t/c3w1-log-perplexity-function/687049 "2024-09-03T06:35:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ernest\_Divine](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@Ernest\_Divine](https://community.deeplearning.ai/u/Ernest_Divine)\
**Post date:** [September 3, 2024, 6:35am UTC](https://community.deeplearning.ai/t/c3w1-log-perplexity-function/687049/1 "2024-09-03T06:35:06Z")

</div>

I keep getting this Assertion error for the log\_perplexity function.

 ![Screenshot (550)](https://global.discourse-cdn.com/dlai/original/3X/b/e/be1ff525b2241f9abc01bd9d61f9de2ca85551cf.png)

---

<div class="post-metadata">

**Author:** ![gent.spah](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/gent.spah/32/136423_2.png) [@gent.spah](https://community.deeplearning.ai/u/gent.spah)\
**Post date:** [September 3, 2024, 6:40am UTC](https://community.deeplearning.ai/t/c3w1-log-perplexity-function/687049/2 "2024-09-03T06:40:21Z")

</div>

There should be something wrong in the implementation of the function, you can send me that function only in a private message I will check it!

---

<div class="post-metadata">

**Author:** ![gent.spah](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/gent.spah/32/136423_2.png) [@gent.spah](https://community.deeplearning.ai/u/gent.spah)\
**Post date:** [September 3, 2024, 7:04am UTC](https://community.deeplearning.ai/t/c3w1-log-perplexity-function/687049/3 "2024-09-03T07:04:45Z")

</div>

The problem here was an issue with the implementation of log\_perplexity function!

---

<div class="post-metadata">

**Author:** ![Ernest\_Divine](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@Ernest\_Divine](https://community.deeplearning.ai/u/Ernest_Divine)\
**Post date:** [September 3, 2024, 7:09am UTC](https://community.deeplearning.ai/t/c3w1-log-perplexity-function/687049/4 "2024-09-03T07:09:43Z")

</div>

Fixed now.  
Thanks!
