CategoricalCrossentropy¶
- class
dragon.vm.tensorflow.keras.losses.
CategoricalCrossentropy
(
axis=- 1,
reduction='mean',
name=None
)[source]¶ A criterion to compute the categorical cross entropy with contiguous targets.
The CrossEntropy function is defined as:
Examples:
__init__¶
CategoricalCrossentropy.
__init__
(
axis=- 1,
reduction='mean',
name=None
)[source]¶Create a
CategoricalCrossentropy
criterion.- Parameters:
- axis (int, optional, default=-1) – The axis to apply softmax.
- reduction ({'none', 'sum', 'mean', 'valid'}, optional) – The reduction method.
- name (str, optional) – The operation name.
Methods¶
__call__¶
Loss.
__call__
(
y_true,
y_pred
)[source]Compute the defined loss function.
- Parameters:
- y_true (dragon.Tensor) – The ground-truth tensor.
- y_pred (dragon.Tensor) – The logits tensor.
- Returns:
dragon.Tensor – The loss.