Considering that all exercises before compiled successfully and all tests passed, I don’t understand why the non-exercise cell on topic 4 of the Assigment

```
model = util.unet_model_3d(loss_function=soft_dice_loss, metrics=[dice_coefficient])
```

Is giving me the following error:

Okay, if anyone else had this problem I solved it by using K.sum() instead of np.sum() in the loss function.

Hi @TiagoSestari

First, congratulations on figuring this out on your own. It may not be very clear why K.sum would act differently than np.sum, but I believe the reason is that the model deals with tensors and is expecting a tensor, not an np array.

That’s probably why the instructions say " * Please use the Keras.sum(x,axis=) function to compute the numerator and denominator of the dice coefficient." But it is fun to experiment, and that often leads to better learning and understanding, if one has the time and interest.

If you check C1 W1 assignment, you are asked to use Keras.mean and Keras.log under " Exercise 3 - Get Weighted Loss".

Good luck, and thanks for sharing the issue and the solution.