SiaNet/Layers/Core/Dense.cs
/// <summary>
/// Forwards the inputs and compute the output
/// </summary>
/// <param name="x">The input tensor for this layer.</param>
Forwards the inputs and compute the output
Forwards the inputs and compute the output
public override void Forward(Tensor x)
        {
            base.Forward(x);
            Parameter weight = BuildParam("w", new long[] { x.Shape[1], Dim }, x.ElementType, KernelInitializer, KernelConstraint, KernelRegularizer);
            Parameter bias = null;
            Output = K.Dot(x, weight.Data);
            if (UseBias)
            {
                bias = BuildParam("b", new long[] { 1, Dim }, x.ElementType, BiasInitializer, BiasConstraint, BiasRegularizer);
                Output = Output + bias.Data;
            }
            if (Act != null)
            {
                Act.Forward(Output);
                Output = Act.Output;
            }
        }
public override void Forward ( Tensor x ) { base . Forward ( x ) ; Parameter weight = BuildParam ( " " , new long [ ] { x . Shape [ 1 ] , Dim } , x . ElementType , KernelInitializer , KernelConstraint , KernelRegularizer ) ; Parameter bias = null ; Output = K . Dot ( x , weight . Data ) ; if ( UseBias ) { bias = BuildParam ( " " , new long [ ] { 1 , Dim } , x . ElementType , BiasInitializer , BiasConstraint , BiasRegularizer ) ; Output = Output + bias . Data ; } if ( Act != null ) { Act . Forward ( Output ) ; Output = Act . Output ; } }
Forwards the inputs and compute the output
Forwards the inputs and compute the output
x
Tensor
The input tensor for this layer.
The input tensor for this layer .