Towards Data Science, Artificial Intelligence, TensorFlow, Machine Learning, Deep Learning.
attributes def __init__(self, threshold): super().__init__() self.threshold = threshold #compute loss def call(self, y_true, y_pred): error = y_true - y_pred is_small_error = tf.abs(error) <= self.threshold small_error_loss = tf.square(error) / 2 big_error_loss = self.threshold * (tf.abs(error) -