Week 4 - assignment 2 UNQ_C5 error

image
In the notebook it mentions that “All tests passed”. However, I believe the grader picks out the difference in the decimal values and doesn’t score me for this cell or it maybe something else.


I have tried changing my code in exercise 3 (where I define the cost function for the style layer), but still no progress. Any solutions?

I think there is an error with the data types in cell UNQ_C5.
If you just had a numerical error, it would probably say “value error” instead of “type error”.

1 Like

I opened the notebook again and removed the alpha and beta values from UNQ_C5 and let the default values do their work. I then submitted the work and got a 100/100. It could be due to opening the notebook again some time later or it could be the latter.

This was the error:

Code Cell UNQ_C5: Unexpected error (TypeError(‘in user code:\n\n /tmp/student_solution_cells/cell_26.py:56 train_step *\n grad = tape.gradient(J, generated_image)\n /usr/local/lib/python3.7/site-packages/tensorflow/python/eager/backprop.py:1034 gradient **\n if not backprop_util.IsTrainable(t):\n /usr/local/lib/python3.7/site-packages/tensorflow/python/eager/backprop_util.py:30 IsTrainable\n dtype = dtypes.as_dtype(dtype)\n /usr/local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:650 as_dtype\n (type_value,))\n\n TypeError: Cannot convert value None to a TensorFlow DType.\n’)) occurred during function check. We expected function train_step to return train_step test 1 failed. Please check that this function is defined properly.

Also, this was the same:
image

Re-opening the notebook later could have been what fixed it, because that restarts the kernel.

1 Like

My experience is that the reopening solves it

1 Like