# C3W3 Exercise 2 on creating masks

I surely have no idea how to implement a mask in `mask_exclude_positives` especially for the second mask, seems I forgot to how to do so from other labs/courses.

Take a look at these calculations, it might suggest you whatâ€™s going on.

Cheers

Well, I got stuck at the `mask_exclude_positives`, I have no idea how to calculate it and what functions to use for.

These are the instructions given for you:

To create the mask, you need to check if the cell is diagonal by computing `tf.eye(batch_size) ==1`, or if the non-diagonal cell is greater than the diagonal with `(negative_zero_on_duplicate > tf.expand_dims(positive, 1)`

In other words, you just need a Python â€śorâ€ť operator `|` for these two.

As you can see in the picture, the first one creates matrix with TRUE values in the diagonal.
The second, in our case, is TRUE values on the bottom row.
These two combined with Python â€śorâ€ť would leave only one FALSE value in the top right corner of the matrix. Which after using `tf.cast()` would change True/False values to 1/0 values. And this result would be the `mask_exclude_positives`.

Cheers

1 Like

Thank you so much! It worked!