Class BaseLoss
A loss function (or objective function, or optimization score function) is one of the two parameters required to compile a model.
Inheritance
System.Object
BaseLoss
Namespace: SiaNet.Losses
Assembly: SiaNet.dll
Syntax
public abstract class BaseLoss
Constructors
| Improve this Doc View SourceBaseLoss(String)
Initializes a new instance of the BaseLoss class.
Declaration
public BaseLoss(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the loss function. |
Properties
| Improve this Doc View SourceName
Gets or sets the name of the loss function
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The name. |
Methods
| Improve this Doc View SourceBackward(Tensor, Tensor)
Backpropagation method to calculate gradient of the loss function
Declaration
public abstract Tensor Backward(Tensor preds, Tensor labels)
Parameters
| Type | Name | Description |
|---|---|---|
| Tensor | preds | The predicted result. |
| Tensor | labels | The true result. |
Returns
| Type | Description |
|---|---|
| Tensor |
Forward(Tensor, Tensor)
Forwards the inputs and calculate the loss.
Declaration
public abstract Tensor Forward(Tensor preds, Tensor labels)
Parameters
| Type | Name | Description |
|---|---|---|
| Tensor | preds | The predicted result. |
| Tensor | labels | The true result. |
Returns
| Type | Description |
|---|---|
| Tensor |