Struct PoissonNLLLossOptions

Page Contents

Struct Documentation

struct torch::nn::PoissonNLLLossOptions

Options for the PoissonNLLLoss module.


PoissonNLLLoss model(PoissonNLLLossOptions().log_input(false).full(true).eps(0.42).reduction(torch::kSum));

Public Types

typedef c10::variant<enumtype::kNone, enumtype::kMean, enumtype::kSum> reduction_t

Public Functions

auto log_input(const bool &new_log_input) -> decltype(*this)

if true the loss is computed as exp(input) - target * input, if false the loss is input - target * log(input + eps).

auto log_input(bool &&new_log_input) -> decltype(*this)
const bool &log_input() const noexcept
bool &log_input() noexcept
auto full(const bool &new_full) -> decltype(*this)

whether to compute full loss, i.e.

to add the Stirling approximation term target * log(target) - target + 0.5 * log(2 * pi * target).

auto full(bool &&new_full) -> decltype(*this)
const bool &full() const noexcept
bool &full() noexcept
auto eps(const double &new_eps) -> decltype(*this)

Small value to avoid evaluation of log(0) when log_input = false.

Default: 1e-8

auto eps(double &&new_eps) -> decltype(*this)
const double &eps() const noexcept
double &eps() noexcept
auto reduction(const reduction_t &new_reduction) -> decltype(*this)

Specifies the reduction to apply to the output. Default: Mean.

auto reduction(reduction_t &&new_reduction) -> decltype(*this)
const reduction_t &reduction() const noexcept
reduction_t &reduction() 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