View source on GitHub |
Loss base class.
tf.keras.Loss(
name=None, reduction='sum_over_batch_size', dtype=None
)
To be implemented by subclasses:
call()
: Contains the logic for loss calculation usingy_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
call(
y_true, y_pred
)
from_config
@classmethod
from_config( config )
get_config
get_config()
__call__
__call__(
y_true, y_pred, sample_weight=None
)
Call self as a function.