Struct AdaptiveLogSoftmaxWithLossOptions

Page Contents

Struct Documentation

struct torch::nn::AdaptiveLogSoftmaxWithLossOptions

Options for the AdaptiveLogSoftmaxWithLoss module.


AdaptiveLogSoftmaxWithLoss model(AdaptiveLogSoftmaxWithLossOptions(8, 10, {4, 8}).div_value(2.).head_bias(true));

Public Functions

AdaptiveLogSoftmaxWithLossOptions(int64_t in_features, int64_t n_classes, std::vector<int64_t> cutoffs)
auto in_features(const int64_t &new_in_features) -> decltype(*this)

Number of features in the input tensor.

auto in_features(int64_t &&new_in_features) -> decltype(*this)
const int64_t &in_features() const noexcept
int64_t &in_features() noexcept
auto n_classes(const int64_t &new_n_classes) -> decltype(*this)

Number of classes in the dataset.

auto n_classes(int64_t &&new_n_classes) -> decltype(*this)
const int64_t &n_classes() const noexcept
int64_t &n_classes() noexcept
auto cutoffs(const std::vector<int64_t> &new_cutoffs) -> decltype(*this)

Cutoffs used to assign targets to their buckets.

auto cutoffs(std::vector<int64_t> &&new_cutoffs) -> decltype(*this)
const std::vector<int64_t> &cutoffs() const noexcept
std::vector<int64_t> &cutoffs() noexcept
auto div_value(const double &new_div_value) -> decltype(*this)

value used as an exponent to compute sizes of the clusters. Default: 4.0

auto div_value(double &&new_div_value) -> decltype(*this)
const double &div_value() const noexcept
double &div_value() noexcept
auto head_bias(const bool &new_head_bias) -> decltype(*this)

If true, adds a bias term to the ‘head’ of the adaptive softmax.

Default: false

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