Backends/SiaNet.Backend.MxNet/NDArrayOps.cs
/// <summary>
/// Applies instance normalization to the n-dimensional input array.This operator takes an n-dimensional input array where (n>2) and normalizesthe input using the following formula:.. math::  out = \frac{x - mean[data]}{ \sqrt{Var[data]} + \epsilon} * gamma + betaThis layer is similar to batch normalization layer (`BatchNorm`)with two differences: first, the normalization iscarried out per example (instance), not over a batch. Second, thesame normalization is applied both at test and train time. Thisoperation is also known as `contrast normalization`.If the input data is of shape [batch, channel, spacial_dim1, spacial_dim2, ...],`gamma` and `beta` parameters must be vectors of shape [channel].This implementation is based on paper:.. [1] Instance Normalization: The Missing Ingredient for Fast Stylization,   D. Ulyanov, A. Vedaldi, V. Lempitsky, 2016 (arXiv:1607.08022v2).Examples::  // Input of shape (2,1,2)  x = [[[ 1.1,  2.2]],       [[ 3.3,  4.4]]]  // gamma parameter of length 1  gamma = [1.5]  // beta parameter of length 1  beta = [0.5]  // Instance normalization is calculated with the above formula  InstanceNorm(x,gamma,beta) = [[[-0.997527  ,  1.99752665]],                                [[-0.99752653,  1.99752724]]]Defined in G:\deeplearn\mxnet\src\operator\instance_norm.cc:L94
/// </summary>
/// <param name="@out">output NDArray</param>
/// <param name="data">An n-dimensional input array (n > 2) of the form [batch, channel, spatial_dim1, spatial_dim2, ...].</param>
/// <param name="gamma">A vector of length 'channel', which multiplies the normalized input.</param>
/// <param name="beta">A vector of length 'channel', which is added to the product of the normalized input and the weight.</param>
/// <param name="eps">An `epsilon` parameter to prevent division by 0.</param>
/// <returns>returns new symbol</returns>
Applies instance normalization to the n-dimensional input array.This operator takes an n-dimensional input array where (n>2) and normalizesthe input using the following formula:.. math::  out = \frac{x - mean[data]}{ \sqrt{Var[data]} + \epsilon} * gamma + betaThis layer is similar to batch normalization layer (`BatchNorm`)with two differences: first, the normalization iscarried out per example (instance), not over a batch. Second, thesame normalization is applied both at test and train time.
Applies instance normalization to the n - dimensional input array . This operator takes an n - dimensional input array where ( n > 2 ) and normalizesthe input using the following formula : .. math :: out = \ frac { x - mean [ data ] } { \ sqrt { Var [ data ] } + \ epsilon } * gamma + betaThis layer is similar to batch normalization layer ( ` BatchNorm ` ) with two differences : first the normalization iscarried out per example ( instance ) not over a batch . Second thesame normalization is applied both at test and train time .
public static NDArray InstanceNorm(NDArray @out,
        NDArray data,
        NDArray gamma,
        NDArray beta,
        float eps = 0.001f)
        {
            return new Operator("InstanceNorm")
            .SetParam("eps", eps)
            .SetInput("data", data)
            .SetInput("gamma", gamma)
            .SetInput("beta", beta)
            .Invoke(@out);
        }
public static NDArray InstanceNorm ( NDArray @out , NDArray data , NDArray gamma , NDArray beta , float eps = 0.001f ) { return new Operator ( " " ) . SetParam ( " " , eps ) . SetInput ( " " , data ) . SetInput ( " " , gamma ) . SetInput ( " " , beta ) . Invoke ( @out ) ; }
Applies instance normalization to the n-dimensional input array.This operator takes an n-dimensional input array where (n>2) and normalizesthe input using the following formula:.. math::  out = \frac{x - mean[data]}{ \sqrt{Var[data]} + \epsilon} * gamma + betaThis layer is similar to batch normalization layer (`BatchNorm`)with two differences: first, the normalization iscarried out per example (instance), not over a batch.
Applies instance normalization to the n - dimensional input array . This operator takes an n - dimensional input array where ( n > 2 ) and normalizesthe input using the following formula : .. math :: out = \ frac { x - mean [ data ] } { \ sqrt { Var [ data ] } + \ epsilon } * gamma + betaThis layer is similar to batch normalization layer ( ` BatchNorm ` ) with two differences : first the normalization iscarried out per example ( instance ) not over a batch .
returns new symbol
returns new symbol
@out
NDArray
None
data
NDArray
An n-dimensional input array (n > 2) of the form [batch, channel, spatial_dim1, spatial_dim2, ...].
An n - dimensional input array ( n > 2 ) of the form [ batch channel spatial_dim1 spatial_dim2 ... ] .
gamma
NDArray
A vector of length 'channel', which multiplies the normalized input.
A vector of length ' channel ' which multiplies the normalized input .
beta
NDArray
A vector of length 'channel', which is added to the product of the normalized input and the weight.
A vector of length ' channel ' which is added to the product of the normalized input and the weight .
eps
float
An `epsilon` parameter to prevent division by 0.
An ` epsilon ` parameter to prevent division by 0 .