Ok. I removed the casting of it. But i am still getting an error on the last test. It prints out the first all 6 checks and its on the 6th test that it is failing with this message:
AssertionError Traceback (most recent call last)
in
23 y_pred_perfect = ([[1., 0.], [1., 0.]],[[1., 0.], [1., 0.]], [[0., 1.], [0., 1.]])
24 loss = triplet_loss(y_true, y_pred_perfect, 3)
—> 25 assert loss == 2., “Wrong value. Are you applying tf.reduce_sum to get the loss?”
AssertionError: Wrong value. Are you applying tf.reduce_sum to get the loss?
Here is everything i print out
New Line
pos tf.Tensor(9865.781, shape=(), dtype=float32)
neg tf.Tensor(10190.6, shape=(), dtype=float32)
loss tf.Tensor(0.0, shape=(), dtype=float32)
loss = tf.Tensor(0.0, shape=(), dtype=float32)
New Line
pos tf.Tensor(0.0, shape=(), dtype=float32)
neg tf.Tensor(0.0, shape=(), dtype=float32)
loss tf.Tensor(5.0, shape=(), dtype=float32)
New Line
pos tf.Tensor(0.0, shape=(), dtype=float32)
neg tf.Tensor(2.0, shape=(), dtype=float32)
loss tf.Tensor(1.0, shape=(), dtype=float32)
New Line
pos tf.Tensor(2.0, shape=(), dtype=float32)
neg tf.Tensor(0.0, shape=(), dtype=float32)
loss tf.Tensor(2.0, shape=(), dtype=float32)
New Line
pos tf.Tensor(0.0, shape=(), dtype=float32)
neg tf.Tensor(0.0, shape=(), dtype=float32)
loss tf.Tensor(0.0, shape=(), dtype=float32)
New Line
pos tf.Tensor(0.0, shape=(), dtype=float32)
neg tf.Tensor(4.0, shape=(), dtype=float32)
loss tf.Tensor(0.0, shape=(), dtype=float32)