def compute_total_loss_test(target, Y):
pred = tf.constant([[ 2.4048107, 5.0334096 ],
[-0.7921977, -4.1523376 ],
[ 0.9447198, -0.46802214],
[ 1.158121, 3.9810789 ],
[ 4.768706, 2.3220146 ],
[ 6.1481323, 3.909829 ]])
minibatches = Y.batch(2)
for minibatch in minibatches:
result = target(pred, tf.transpose(minibatch))
break
print(result)
assert(type(result) == EagerTensor), "Use the TensorFlow API"
assert (np.abs(result - (0.50722074 + 1.1133534) / 2.0) < 1e-7), "Test does not match. Did you get the reduce sum of your loss functions?"
print("\033[92mAll test passed")
compute_total_loss_test(compute_total_loss, new_y_train )
Error:
tf.Tensor(0.028503546, shape=(), dtype=float32)
AssertionError Traceback (most recent call last)
in
17 print(“\033[92mAll test passed”)
18
—> 19 compute_total_loss_test(compute_total_loss, new_y_train )
in compute_total_loss_test(target, Y)
13 print(result)
14 assert(type(result) == EagerTensor), “Use the TensorFlow API”
—> 15 assert (np.abs(result - (0.50722074 + 1.1133534) / 2.0) < 1e-7), “Test does not match. Did you get the reduce sum of your loss functions?”
16
17 print(“\033[92mAll test passed”)
AssertionError: Test does not match. Did you get the reduce sum of your loss functions?