Class RationalLoss

Inheritance Relationships

Derived Type

Class Documentation

class RationalLoss

We represent loss as pair of expressions, where loss_ is usually a sum of all accumulated loss values per label and count_ is the total number of labels over which the loss was collected.

These two values can then be used to represent various cost variants - for instance label-wise cross-entropy or perplexity. Optimization is only performed with regard to the summed loss_.

Since both, loss_ and count_ are dynamic graph nodes they can be further combined into larger structures. See multi-objective losses below.

@TODO: This seems also used to hold a pair of (logits, mask)

Subclassed by marian::MultiRationalLoss

Public Functions

RationalLoss(Expr loss, Expr count)
RationalLoss(Expr loss, float count)
RationalLoss(const RationalLoss &other)
virtual ~RationalLoss()
Expr loss() const
template<typename T>
void loss(std::vector<T> &losses) const
template<typename T>
T loss() const
Expr count() const
template<typename T>
void count(std::vector<T> &labels) const
template<typename T>
T count() const
size_t size() const

Protected Functions

RationalLoss()

Protected Attributes

Expr loss_
Expr count_