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
Inherited Members
Namespace: SiaNet.Losses
Assembly: SiaNet.dll
Syntax
public class BinaryCrossentropy : BaseLoss
Constructors
| Improve this Doc View SourceBinaryCrossentropy(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 |
Properties
| Improve this Doc View SourceFromLogit
Gets or sets a value indicating whether [from logit].
Declaration
public bool FromLogit { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
| Improve this Doc View SourceBackward(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
| Improve this Doc View SourceForward(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 |