Class BaseLayer
Base class for the layers
Inheritance
Namespace: SiaNet.Layers
Assembly: SiaNet.dll
Syntax
public abstract class BaseLayer
Constructors
| Improve this Doc View SourceBaseLayer(String)
Initializes a new instance of the BaseLayer class.
Declaration
public BaseLayer(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
Fields
| Improve this Doc View SourceInput
The input tensor parameter
Declaration
[NonSerialized]
public Parameter Input
Field Value
Type | Description |
---|---|
Parameter |
Output
The output tensor parameter
Declaration
[NonSerialized]
public Tensor Output
Field Value
Type | Description |
---|---|
Tensor |
Params
The parameters list used by the layer
Declaration
[NonSerialized]
public Dictionary<string, Parameter> Params
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, Parameter> |
Properties
| Improve this Doc View SourceItem[String]
Gets or sets the Parameter with the specified name.
Declaration
public Parameter this[string name] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
Property Value
Type | Description |
---|---|
Parameter | The Parameter. |
Name
Gets or sets the name of the layer
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name. |
SkipPred
Gets or sets a value indicating whether the layer is train only
Declaration
public bool SkipPred { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
| Improve this Doc View SourceBackward(Tensor)
Calculate the gradient of this layer function
Declaration
public virtual void Backward(Tensor outputgrad)
Parameters
Type | Name | Description |
---|---|---|
Tensor | outputgrad | The calculated output grad from previous layer. |
BuildParam(String, Int64[], DataType, BaseInitializer, BaseConstraint, BaseRegularizer, Boolean)
Builds the parameter with specified parameter. Used to create weight or bias parameter for the layer.
Declaration
public Parameter BuildParam(string name, long[] shape, DataType elementType, BaseInitializer initializer, BaseConstraint constraint = null, BaseRegularizer regularizer = null, bool trainable = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the parameter. |
System.Int64[] | shape | The shape of the tensor. |
DataType | elementType | Datatype of the tensor. |
BaseInitializer | initializer | The initializer used to create the parameter. |
BaseConstraint | constraint | The constraint function applied for this parameter. |
BaseRegularizer | regularizer | The regularizer function for this parameter. |
System.Boolean | trainable | if set to |
Returns
Type | Description |
---|---|
Parameter |
Forward(Tensor)
Forwards the inputs and compute the output
Declaration
public virtual void Forward(Tensor x)
Parameters
Type | Name | Description |
---|---|---|
Tensor | x | The input tensor for this layer. |