DLS 2 Week 3_Exercise_6_compute_cost()_labels_tensor_error

I am facing an issue while attempting Exercise-6 of week-3 assignment of course 2 of DLS. The labels tensor provided in the work book has a shape of (4,2) however the text in the workbook mentions it should be (6,2). Due to this I am unable to run the loss function and hence unable to complete this assignment. Anybody else who faced the same issue

The problem is probably at one_hot_matrix function, the depth parameter there is set at 6!

The test function uses different data to test your code, so, the shape would be different in both cases.

Regarding your query, you have to transpose the labels and logits. And, don’t forget to set the parameter from_logits=True.

The logits was set to True already but the dimension error persisted

I have run the classification function in colab, the function doesn’t work with different dimensional data.

Are you doing this in a Coursera environment?

Yes, I am doing my assignment

@gent.spah I changed it to 4 as the function was throwing error with depth set to 6

I see! You hard-coded the depth. The depth should not be 4 or 6 because the test function and grader use different values for depth. Do your code so your one_hot_matrix function can take any value of depth.

Thanks! the issue is resolved.