Struct BCEWithLogitsLossOptions

Page Contents

Struct Documentation

struct BCEWithLogitsLossOptions

Options for the BCEWithLogitsLoss module.



Public Types

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

Public Functions

inline auto weight(const Tensor &new_weight) -> decltype(*this)

A manual rescaling weight given to the loss of each batch element.

If given, has to be a Tensor of size nbatch.

inline auto weight(Tensor &&new_weight) -> decltype(*this)
inline const Tensor &weight() const noexcept
inline Tensor &weight() 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
inline auto pos_weight(const Tensor &new_pos_weight) -> decltype(*this)

A weight of positive examples.

Must be a vector with length equal to the number of classes.

inline auto pos_weight(Tensor &&new_pos_weight) -> decltype(*this)
inline const Tensor &pos_weight() const noexcept
inline Tensor &pos_weight() 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