Contents

layerNorm(weight:bias:axes:epsilon:)

Adds a layer normalization operation to the current graph.

Declaration

func layerNorm(weight: some BNNSGraph.Builder.OperationParameter<T>, bias: some BNNSGraph.Builder.OperationParameter<T>, axes: [Int], epsilon: Float = .ulpOfOne.squareRoot()) -> BNNSGraph.Builder.Tensor<T>

Parameters

  • weight:

    The weight values.

  • bias:

    The bias values.

  • axes:

    The axes over which the operation performs normalization.

  • epsilon:

    The epsilon value that the function uses to avoid division by zero.

Discussion

This function performs layer normalization of self with an affine transform using weight and bias.

The shape of weight and bias must match the corresponding dimensions of self specified in axes.