Shortcuts

Struct LayerNormOptions

Page Contents

Struct Documentation

struct LayerNormOptions

Options for the LayerNorm module.

Example:

LayerNorm model(LayerNormOptions({2,
2}).elementwise_affine(false).eps(2e-5));

Public Functions

LayerNormOptions(std::vector<int64_t> normalized_shape)
inline auto normalized_shape(const std::vector<int64_t> &new_normalized_shape) -> decltype(*this)

input shape from an expected input.

inline auto normalized_shape(std::vector<int64_t> &&new_normalized_shape) -> decltype(*this)
inline const std::vector<int64_t> &normalized_shape() const noexcept
inline std::vector<int64_t> &normalized_shape() noexcept
inline auto eps(const double &new_eps) -> decltype(*this)

a value added to the denominator for numerical stability.

Default: 1e-5.

inline auto eps(double &&new_eps) -> decltype(*this)
inline const double &eps() const noexcept
inline double &eps() noexcept
inline auto elementwise_affine(const bool &new_elementwise_affine) -> decltype(*this)

a boolean value that when set to true, this module has learnable per-element affine parameters initialized to ones (for weights) and zeros (for biases).

Default: true.

inline auto elementwise_affine(bool &&new_elementwise_affine) -> decltype(*this)
inline const bool &elementwise_affine() const noexcept
inline bool &elementwise_affine() noexcept

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources