Below is the error message that I got. I don’t know how to assure the shapes of labels and logits in the piece of code that I write. May I ask for help in this forum here? Thank you.
Test 1: tf.Tensor(17.175789, shape=(), dtype=float32)
AssertionError Traceback (most recent call last)
in
25 print(“\033[92mAll test passed”)
26
—> 27 compute_total_loss_test(compute_total_loss, new_y_train )
in compute_total_loss_test(target, Y)
13 print("Test 1: ", result)
14 assert(type(result) == EagerTensor), “Use the TensorFlow API”
—> 15 assert (np.abs(result - (0.50722074 + 1.1133534) / 2.0) < 1e-7), “Test 1 does not match. Did you get the reduce sum of your loss functions?”
16
17 ### Test 2
AssertionError: Test 1 does not match. Did you get the reduce sum of your loss functions?
Did you check this suggestion!
Here’s a thread with a checklist of the common errors on this function.
1 Like
I did…using tf.reduce_sum()
Thank you. The list is indeed helpful.
May I ask a stupid question here: I used tf.transpose() on the inputs, but seemingly does not work. Do we need to transpose ‘labels’ or ‘logits’ here?
This is the error message i got after replacing ‘labels’ and ‘logits’ by ‘tf.transpose(labels)’ and ‘tf.transpose(logits)’. Don’t know what’s the problem now…
Test 1: tf.Tensor(40.436035, shape=(), dtype=float32)
AssertionError Traceback (most recent call last)
in
25 print(“\033[92mAll test passed”)
26
—> 27 compute_total_loss_test(compute_total_loss, new_y_train )
in compute_total_loss_test(target, Y)
13 print("Test 1: ", result)
14 assert(type(result) == EagerTensor), “Use the TensorFlow API”
—> 15 assert (np.abs(result - (0.50722074 + 1.1133534) / 2.0) < 1e-7), “Test 1 does not match. Did you get the reduce sum of your loss functions?”
16
17 ### Test 2
AssertionError: Test 1 does not match. Did you get the reduce sum of your loss functions?
Have you checked the checklist Paul mentioned?
That is the wrong answer you get if you have the positional arguments to the loss function in the wrong order, but did get the transposes correct. Please compare your call to the documentation for that function. That link was given in the instructions for this function in the notebook.
1 Like