Class Dense
Dense implements the operation: output = activation(dot(input, kernel) + bias) where activation is the element-wise activation function passed as the activation argument, kernel is a weights matrix created by the layer, and bias is a bias vector created by the layer (only applicable if use_bias is True).
Inherited Members
Namespace: SiaNet.Layers
Assembly: SiaNet.dll
Syntax
public class Dense : BaseLayer
Constructors
| Improve this Doc View SourceDense(Int32, ActType, BaseInitializer, BaseRegularizer, BaseConstraint, Boolean, BaseInitializer, BaseRegularizer, BaseConstraint)
Initializes a new instance of the Dense class.
Declaration
public Dense(int dim, ActType activation = ActType.Linear, BaseInitializer kernelInitializer = null, BaseRegularizer kernelRegularizer = null, BaseConstraint kernelConstraint = null, bool useBias = true, BaseInitializer biasInitializer = null, BaseRegularizer biasRegularizer = null, BaseConstraint biasConstraint = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dim | Dimensions of the output space |
ActType | activation | Activation function to use. If none specified linear activation will be used |
BaseInitializer | kernelInitializer | Initializer for kernel weight matrix. |
BaseRegularizer | kernelRegularizer | Regularizer function applied to bias weight matrix |
BaseConstraint | kernelConstraint | Constraint function applied to kernel weight matrix. |
System.Boolean | useBias | if set to |
BaseInitializer | biasInitializer | Initializer for bias weight matrix |
BaseRegularizer | biasRegularizer | Regularizer function applied to bias weight matrix |
BaseConstraint | biasConstraint | Constraint function applied to bias weight matrix |
Properties
| Improve this Doc View SourceAct
Activation function to use. If none specified linear activation will be used
Declaration
public BaseLayer Act { get; set; }
Property Value
Type | Description |
---|---|
BaseLayer | The act. |
BiasConstraint
Constraint function applied to bias weight matrix
Declaration
public BaseConstraint BiasConstraint { get; set; }
Property Value
Type | Description |
---|---|
BaseConstraint | The bias constraint. |
BiasInitializer
Initializer for bias weight matrix
Declaration
public BaseInitializer BiasInitializer { get; set; }
Property Value
Type | Description |
---|---|
BaseInitializer | The bias initializer. |
BiasRegularizer
Constraint function applied to bias weight matrix
Declaration
public BaseRegularizer BiasRegularizer { get; set; }
Property Value
Type | Description |
---|---|
BaseRegularizer | The bias regularizer. |
Dim
Dimensions of the output space
Declaration
public int Dim { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The dim. |
KernelConstraint
Constraint function applied to kernel weight matrix
Declaration
public BaseConstraint KernelConstraint { get; set; }
Property Value
Type | Description |
---|---|
BaseConstraint | The kernel constraint. |
KernelInitializer
Initializer for kernel weight matrix
Declaration
public BaseInitializer KernelInitializer { get; set; }
Property Value
Type | Description |
---|---|
BaseInitializer | The kernel initializer. |
KernelRegularizer
Regularizer function applied to kernel weight matrix
Declaration
public BaseRegularizer KernelRegularizer { get; set; }
Property Value
Type | Description |
---|---|
BaseRegularizer | The kernel regularizer. |
UseBias
Gets or sets a value indicating whether to use bias parameter.
Declaration
public bool UseBias { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
| Improve this Doc View SourceBackward(Tensor)
Calculate the gradient of this layer function
Declaration
public override void Backward(Tensor outputgrad)
Parameters
Type | Name | Description |
---|---|---|
Tensor | outputgrad | The calculated output grad from previous layer. |
Overrides
| Improve this Doc View SourceForward(Tensor)
Forwards the inputs and compute the output
Declaration
public override void Forward(Tensor x)
Parameters
Type | Name | Description |
---|---|---|
Tensor | x | The input tensor for this layer. |