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) - (0.5 * self.threshold))
return tf.where(is_small_error, small_error_loss, big_error_loss)
When this call function is called/used?
model.compile(optimizer=‘sgd’, loss=MyHuberLoss(threshold=1)) #
MyHuberLoss(threshold=1) – create an object for My HumberLoss.
my question, when this object use the call function.
object=MyHuberLoss(threshold=1)
object.call()
Thanks