C3W2 Exercise5: Need help for getting masked_accuacy

I understand that the mask should be based on y_true values, that -1 values in y_true should be masked out (given a value of 0) while other values should be assigned value of 1 in the corresponding position of the mask.

I’ve been trying ways to define the mask but it is not working and I need some help!

Can someone shed some light on what the mask is supposed to be like? A list or a tensor? And how to define its shape?

I’ve tried iterating over y_true to get the mask but this gives an error at the later part where the model is fit.

Y_true is tensor not need to iterate just check directly for equality (or inequality) for that matter!

3 Likes