sigmoid_cross_entropy

dragon.losses.sigmoid_cross_entropy(
  inputs,
  reduction='valid',
  **kwargs
)[source]

Compute the sigmoid cross entropy with contiguous targets.

The CrossEntropy function is defined as:

\[\text{CrossEntropy}(p_{t}) = -\log(p_{t}) \]

Examples:

logit = dragon.constant([0.1, 0.2, 0.3, 0.4])
target = dragon.constant([0., 0., 1., 1.])
print(dragon.losses.sigmoid_cross_entropy([logit, target]))  # 0.65247655
Parameters:
  • inputs (Sequence[dragon.Tensor]) – The tensor logit and target.
  • reduction ({'none', 'sum', 'mean', 'valid'}, optional) – The reduction method.
Returns:

dragon.Tensor – The output tensor.