-
The function call is “my_softmaxftmax” and the function name is “my_softmax”, and since its an ungraded cell I’m unable to edit it.
-
later in the lab model.summary() causes another error -“ValueError: This model has not yet been built. Build the model first by calling
build()
or by calling the model on a batch of data.”
What do I do?
Hi @Megh001
I’m pretty sure you can edit the function name to fix the first issue. Could you clarify what problem you’re encountering?
For the second issue, this typically happens when the input shape hasn’t been specified.
Hope this helps! Feel free to reach out if you need further assistance.
Hi @Alireza_Saei
The problem with changing the function name is its called twice in the same cell with different names, so changing the name still gives an error.
Hi @Alireza_Saei
This is how I solved both the issues:
- I defined 2 functions with the names “my_softmaxftmax” and “my_softmax”
- I defined the input shape using "tf.keras.Input(shape=(400,)), "
Thanks for you help!
Make sure to update the function name consistently wherever it’s called in the cell. Let me know if you need further assistance!
Good to hear that! Good luck
Please hold on and back up.
Do not modify any of the function names in any assignment notebook.
This is guaranteed to break the grader.
Whatever the problem is, modifying a function name that was provided with the notebook is not a good solution.
Hi @TMosh I have not modified any function names
I just copied the function “my_softmax” and defined another function named “my_softmaxftmax” as well and added it to the cell.
I could see no other solution to my problem.
The function call in the ungraded cell below as u can see in the picture is wrong, I cannot modify that hence this was the only thing I could do.
If you have any other suggestions or solutions please let me know. I would be glad to hear them and make changes accordingly.
When an ungraded cell that you can’t modify is throwing an error, it means that is is testing some code that you wrote (by calling one of the functions). And your code is throwing an error.
So the fix is to repair your code so it doesn’t throw an error. Re-defining the testing method doesn’t address the core problem.
Please check your personal messages for instructions.
For those who find this thread later:
I believe the issue was that the cell with my_softmax() had been edited, but it had not been run. So the test_my_softmax() function could not see the updates to the code.
Tips:
- Always run a cell after you edit it.
- Always run all of the cells in a notebook every time you open the file in your browser.