SiaNet/Layers/Activations/PRelu.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);
            long[] paramShape = x.Shape.ToList().Skip(1).ToArray();
            Parameter alpha = BuildParam("a", paramShape, x.ElementType, AlphaInitializer, AlphaConstraint, AlphaRegularizer);
            pos_relu.Forward(x);
            var pos = pos_relu.Output;
            neg_relu.Forward(-1 * x);
            var neg = -1f * alpha.Data * neg_relu.Output;
            Output = pos + neg;
        }
public override void Forward ( Tensor x ) { base . Forward ( x ) ; long [ ] paramShape = x . Shape . ToList ( ) . Skip ( 1 ) . ToArray ( ) ; Parameter alpha = BuildParam ( " " , paramShape , x . ElementType , AlphaInitializer , AlphaConstraint , AlphaRegularizer ) ; pos_relu . Forward ( x ) ; var pos = pos_relu . Output ; neg_relu . Forward ( - 1 * x ) ; var neg = - 1f * alpha . Data * neg_relu . Output ; Output = pos + neg ; }
Forwards the inputs and compute the output
Forwards the inputs and compute the output
//ToDo: Implement shared axes
x
Tensor
The input tensor for this layer.
The input tensor for this layer .