Towards Data Science, Artificial Intelligence, TensorFlow, Machine Learning, Deep Learning.
the threshold = 1. Next we calculate the error a = y_true-y_pred Next we check if the absolute value of the error is less than or equal to the threshold. is_small_error returns a boolean (True or False). We know that, when, |a| ≤δ, loss = 1/2*(a)², so we calculate the small_error_loss as the square