The call function in side of MyHuberLoss class

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

hello Changbin,

refer this to know when huber loss is used, it is basically custom loss function, whenever you want to create a model with a particular value of threshold, you can use.

Hope it clarifies. Keep learning!!!

Regards
DP