cross_entropy
CrossEntropy
¶
Bases: TensorOp
Calculate Element-Wise CrossEntropy (binary, categorical or sparse categorical).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
Union[None, str, Iterable[str], Callable]
|
A tuple or list like: [ |
None
|
outputs |
Union[None, str, Iterable[str]]
|
String key under which to store the computed loss value. |
None
|
mode |
Union[None, str, Iterable[str]]
|
What mode(s) to execute this Op in. For example, "train", "eval", "test", or "infer". To execute regardless of mode, pass None. To execute in all modes except for a particular one, you can pass an argument like "!infer" or "!train". |
'!infer'
|
from_logits |
bool
|
Whether y_pred is logits (without softmax). |
False
|
average_loss |
bool
|
Whether to average the element-wise loss after the Loss Op. |
True
|
form |
Optional[str]
|
What form of cross entropy should be performed ('binary', 'categorical', 'sparse', or None). None will automatically infer the correct form based on tensor shape. |
None
|