Struct LayerNormOptions

Page Contents

Struct Documentation

struct torch::nn::LayerNormOptions

Options for the LayerNorm module.


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

Public Functions

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

input shape from an expected input.

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

a value added to the denominator for numerical stability. Default: 1e-5.

auto eps(double &&new_eps) -> decltype(*this)
const double &eps() const noexcept
double &eps() noexcept
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.

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


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources