C1M1 Assignment - Exercise 4

The loss becomes ‘nan’ every I run the function. I tried submitting my assignment with the code I believed was correct (even though it didn’t pass unit test 4) and I received 40/40 points on my assignment. I believe there is some error with the question. It also affects the downstream code following this exercise so am not able to see the proper outputs in the rest of the notebook.

Can you be a little more specific about what lab you’re working on? Its name, for example.

Thanks @Anisha_Luthra, I’m going to send you a direct message regarding this.

@TMosh @Mubsi The lab was C1M1 Deeper Regression, Smarter Features - the first programming assignment PyTorch Fundamentals. I realized I made a mistake earlier in the code (in exercise 2) which affected the loss function calculation! I had continued working because it passed the unit test.

Perhaps that unit test can be improved to trap that specific error.

1 Like

Yes, I have already DMed the learner to share their solutions with me.

1 Like

@Mubsi I just DMed you my solution and the initial error I made!

I am having the same issue. It’s the assignment titled “Programming Assignment: Deeper Regression, Smarter Features@Mubsi

The evidence suggests your code is not computing a valid Loss value. “Nan” means “Not a Number”.

@hassanql what helped me is checking to make sure the data was prepared properly. Even though the data preparation step (exercise 2) passed the unit test, I had done it incorrectly. We might’ve done the same thing - I also had the same error initially.

3 Likes

Note that passing the tests in the notebook does not prove your code is perfect.

1 Like

Thank you guys @TMosh @Anisha_Luthra

1 Like

Thank you all. I have updated the Ex 2 test, so that more mistakes can be captured. Hopefully, it’ll resolve this current issue. The changes will go live on the platform soon.

1 Like