tf.keras.Loss

Loss base class.

To be implemented by subclasses:

  • call(): Contains the logic for loss calculation using y_true, y_pred.

Example subclass implementation:

class MeanSquaredError(Loss):
    def call(self, y_true, y_pred):
        return ops.mean(ops.square(y_pred - y_true), axis=-1)

Methods

call

View source

from_config

View source

get_config

View source

__call__

View source

Call self as a function.