C3_W2 LSTM and Named Entity Recognition

I am facing challenge in clearing the Graded Assignment of Week 2.
All the test cases were passed for the Exercise 5 graded function masked_accuracy and Exercise 6.

Link:- Coursera | Online Courses & Credentials From Top Educators. Join for Free | Coursera

Description:- Exercise 5:- All the test cases passed but upon submitting the assignment the grader is showing the below error message:-
Error:- There was an error grading your submission. Details:
{{function_node _wrapped__Mul_device/job:localhost/replica:0/task:0/device:CPU:0}} Incompatible shapes: [14,70] vs. [980] [Op:Mul] name:
How to resolve the issue?

I am using the below code for defining the mask:-
mask = list(map(lambda val: 0 if(val<=-1) else 1, np.array(y_true).ravel()))

Requesting the community’s support regarding the same.

Thanks.

You are not allowed to post solution codes publicly. For exercise 5 the code for mask is much simple, you just compare the y_true tensor directly with -1, no need to loop through all elements of the tensor.

1 Like

Thank you very much for your solution. I was able to successfully pass all the test cases for the function. It is a simple solution. And yes, will remember not to post any part of the solution code in the community forums.