Shortcuts

Struct KLDivLossOptions

Page Contents

Struct Documentation

struct KLDivLossOptions

Options for the KLDivLoss module.

Example:

KLDivLoss
model(KLDivLossOptions().reduction(torch::kNone).log_target(false));

Public Types

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

Public Functions

KLDivLossOptions() = default
inline KLDivLossOptions(torch::enumtype::kNone reduction)
inline KLDivLossOptions(torch::enumtype::kBatchMean reduction)
inline KLDivLossOptions(torch::enumtype::kSum reduction)
inline KLDivLossOptions(torch::enumtype::kMean reduction)
inline auto reduction(const reduction_t &new_reduction) -> decltype(*this)

Specifies the reduction to apply to the output.

'none' | 'batchmean' | 'sum' | 'mean'. Default: 'mean'

inline auto reduction(reduction_t &&new_reduction) -> decltype(*this)
inline const reduction_t &reduction() const noexcept
inline reduction_t &reduction() noexcept
inline auto log_target(const bool &new_log_target) -> decltype(*this)

Specifies whether target is accepted in the log space. Default: False.

inline auto log_target(bool &&new_log_target) -> decltype(*this)
inline const bool &log_target() const noexcept
inline bool &log_target() 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