Shortcuts

Struct PoissonNLLLossOptions

Page Contents

Struct Documentation

struct PoissonNLLLossOptions

Options for the PoissonNLLLoss module.

Example:

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

Public Types

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

Public Functions

inline 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).

inline auto log_input(bool &&new_log_input) -> decltype(*this)
inline const bool &log_input() const noexcept
inline bool &log_input() noexcept
inline 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).

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

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

Default: 1e-8

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

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

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