Shortcuts

Struct KLDivLossOptions

Page Contents

Struct Documentation

struct torch::nn::KLDivLossOptions

Options for the KLDivLoss module.

Example:

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

Public Types

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

Public Functions

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

Specifies the reduction to apply to the output.

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

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

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

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