Struct CTCLossOptions

Page Contents

Struct Documentation

struct torch::nn::CTCLossOptions

Options for the CTCLoss module.


CTCLoss model(CTCLossOptions().blank(42).zero_infinity(false).reduction(torch::kSum));

Public Types

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

Public Functions

auto blank(const int64_t &new_blank) -> decltype(*this)

blank label. Default 0.

auto blank(int64_t &&new_blank) -> decltype(*this)
const int64_t &blank() const noexcept
int64_t &blank() noexcept
auto reduction(const reduction_t &new_reduction) -> decltype(*this)

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

auto reduction(reduction_t &&new_reduction) -> decltype(*this)
const reduction_t &reduction() const noexcept
reduction_t &reduction() noexcept
auto zero_infinity(const bool &new_zero_infinity) -> decltype(*this)

Whether to zero infinite losses and the associated gradients.

Default: false. Infinite losses mainly occur when the inputs are too short to be aligned to the targets.

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