Package ai.djl.nn.norm
Class LayerNorm.Builder
java.lang.Object
ai.djl.nn.norm.LayerNorm.Builder
- Enclosing class:
- LayerNorm
The Builder to construct a
LayerNorm.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaxis(int... axis) List the axis over which the mean and variance will be calculated (alternative to normalizedShape).build()Builds aLayerNormblock.optCenter(boolean val) If True, add offset of `beta` to normalized tensor.optEpsilon(float val) Sets the epsilon value to prevent division by 0.optScale(boolean val) If True, multiply result by `gamma`.
-
Constructor Details
-
Builder
protected Builder()
-
-
Method Details
-
axis
List the axis over which the mean and variance will be calculated (alternative to normalizedShape).- Parameters:
axis- input axis over which the mean and variance will be calculated (if null all existing dimensions)- Returns:
- this Builder
-
optCenter
If True, add offset of `beta` to normalized tensor. Defaults to True.- Parameters:
val- True or False on whether to add and train offset value- Returns:
- this Builder
-
optScale
If True, multiply result by `gamma`. Defaults to True;- Parameters:
val- True or False on whether to add and train scale value- Returns:
- this Builder
-
optEpsilon
Sets the epsilon value to prevent division by 0.- Parameters:
val- the epsilon value- Returns:
- this Builder
-
build
Builds aLayerNormblock.- Returns:
- the
LayerNormblock
-