Show / Hide Table of Contents

Class BinaryCrossentropy

Binary Cross-Entropy Loss. Also called Sigmoid Cross-Entropy loss. It is a Sigmoid activation plus a Cross-Entropy loss. Unlike Softmax loss it is independent for each vector component (class), meaning that the loss computed for every vector component is not affected by other component values

Inheritance
System.Object
BaseLoss
BinaryCrossentropy
Inherited Members
BaseLoss.Name
Namespace: SiaNet.Losses
Assembly: SiaNet.dll
Syntax
public class BinaryCrossentropy : BaseLoss

Constructors

| Improve this Doc View Source

BinaryCrossentropy(Boolean)

Initializes a new instance of the BinaryCrossentropy class.

Declaration
public BinaryCrossentropy(bool fromLogit = false)
Parameters
Type Name Description
System.Boolean fromLogit

if set to true [from logit].

Properties

| Improve this Doc View Source

FromLogit

Gets or sets a value indicating whether [from logit].

Declaration
public bool FromLogit { get; set; }
Property Value
Type Description
System.Boolean

true if [from logit]; otherwise, false.

Methods

| Improve this Doc View Source

Backward(Tensor, Tensor)

Backpropagation method to calculate gradient of the loss function

Declaration
public override Tensor Backward(Tensor preds, Tensor labels)
Parameters
Type Name Description
Tensor preds

The predicted result.

Tensor labels

The true result.

Returns
Type Description
Tensor
Overrides
BaseLoss.Backward(Tensor, Tensor)
| Improve this Doc View Source

Forward(Tensor, Tensor)

Forwards the inputs and calculate the loss.

Declaration
public override Tensor Forward(Tensor preds, Tensor labels)
Parameters
Type Name Description
Tensor preds

The predicted result.

Tensor labels

The true result.

Returns
Type Description
Tensor
Overrides
BaseLoss.Forward(Tensor, Tensor)

See Also

BaseLoss
  • Improve this Doc
  • View Source
Back to top Generated by DocFX