tf.CrossEntropyFromLogitsLayer module

tf.CrossEntropyFromLogitsLayer module

class tf.CrossEntropyFromLogitsLayer.CrossEntropyFromLogitsLayer(*args: Any, **kwargs: Any)

Bases: modelzoo.common.layers.tf.BaseLayer.BaseLayer

Cross entropy loss, given logits. Compares logits against labels.

Parameters
  • boundary_casting (bool) –

  • tf_summary (bool) –

call(labels, logits)

Calculating cross entropy over logits.

Parameters
  • labels (Tensor) – Label indices.

  • logits (Tensor) – Logits (non-normalized).

Returns

A tensor of the same shape as labels and of the same type as logits with the softmax cross entropy loss.

Return type

Tensor