SiaNet/Layers/Core/BatchNormalization.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 beta = BuildParam("beta", x.Shape, x.ElementType, BetaInitializer, BetaConstraint, BetaRegularizer);
            Parameter gamma = BuildParam("gamma", x.Shape, x.ElementType, GammaInitializer, GammaConstraint, GammaRegularizer);
            mu = BuildParam("mm", x.Shape, x.ElementType, MovingMeanInitializer, null, null, false);
            mv = BuildParam("mv", x.Shape, x.ElementType, MovingVarianceInitializer, null, null, false);
            norm = (x - mu.Data) / K.Sqrt((mv.Data + K.Epsilon()));
            var @out = gamma.Data * norm + beta.Data;
            Output = K.Reshape(@out, x.Shape);
        }
public override void Forward ( Tensor x ) { base . Forward ( x ) ; Parameter beta = BuildParam ( " " , x . Shape , x . ElementType , BetaInitializer , BetaConstraint , BetaRegularizer ) ; Parameter gamma = BuildParam ( " " , x . Shape , x . ElementType , GammaInitializer , GammaConstraint , GammaRegularizer ) ; mu = BuildParam ( " " , x . Shape , x . ElementType , MovingMeanInitializer , null , null , false ) ; mv = BuildParam ( " " , x . Shape , x . ElementType , MovingVarianceInitializer , null , null , false ) ; norm = ( x - mu . Data ) / K . Sqrt ( ( mv . Data + K . Epsilon ( ) ) ) ; var @out = gamma . Data * norm + beta . Data ; Output = K . Reshape ( @out , x . Shape ) ; }
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 .