Compute_layer_style_cost Grading

I get, all tests passed, though under train_step the expected values look slightly different
tf.Tensor(10221.224, shape=(), dtype=float32) tf.Tensor(6081.4204, shape=(), dtype=float32) All tests passed

Expected output

tf.Tensor(10221.169, shape=(), dtype=float32)
tf.Tensor(6081.1763, shape=(), dtype=float32)

However the autograger gives 80% and in the diagnosis I see We expected function train_step to return train_step test 1 failed. Please check that this function is defined properly. in the grader output.

Please any help

I don’t understand your statement about test 1 expected to fail. Can you explain a little further?
My solution for the exercise gives this:

tf.Tensor(10221.224, shape=(), dtype=float32)
tf.Tensor(6081.421, shape=(), dtype=float32)
All tests passed
1 Like

Note that because of the random initialization of the generated image, the final cost values will vary a little on each run.

This the output of my autograder
Code Cell UNQ_C1: Function ‘compute_content_cost’ is correct.
Code Cell UNQ_C2: Function ‘gram_matrix’ is correct.
Code Cell UNQ_C3: Function ‘compute_layer_style_cost’ is correct.
Code Cell UNQ_C4: Function ‘total_cost’ is correct.
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.
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors.

I have Resolved it. Thanks

OK, that’s good to know. What was the problem?

I think it was with the autograder, I resubmitted and it graded 100%

More likely that just means that you had not done a “Save” before you did the previous failing submit. The grader does not do the “Save” for you.

1 Like

This is not exactly related by get this error on the same function : NameError: name 'J_style_layer' is not defined. Can you help me? The compute_style_cost and compute_layer_style_cost work fine.

Try restarting the kernel and run all of the cells again.