Course 5 week 2 assignment 2 Emoji_v3a exercise 2 model cost

Hi all,
I am struggling to get the correct cost for the model using the loss function formula:
image

Do I need to write a for loop for the cost? How do I iterate k for Y_oh and a?

The operation you are performing is called categorical crossentropy

* represents element-wise product and since you’re summing over the element-wise products, there is a mathematical operation called dot product that can get this done for you.