pytorch
3cdf18cb - Corrected `HingeEmbeddingLoss` documentation (#95140)

Commit
2 years ago
Corrected `HingeEmbeddingLoss` documentation (#95140) Minor correction. `HingeEmbeddingLoss`'s documentation had this piecewise function; but there is no $\Delta$ in the function definition, it was used to denote `margin`. $$l_n = \begin{cases} x_n, & \text{if}\; y_n = 1,\\ \max \{0, \Delta - x_n\}, & \text{if}\; y_n = -1, \end{cases}$$ Following other documentation guidelines, `HuberLoss` has a parameter `delta`, and its piecewise function is defined as follows; using $delta$ as a reference to the `delta` parameter and not $\Delta$. $$l_n = \begin{cases} 0.5 (x_n - y_n)^2, & \text{if } |x_n - y_n| < delta \\ delta * (|x_n - y_n| - 0.5 * delta), & \text{otherwise } \end{cases}$$ So by analogy, `HingeEmbeddingLoss` should also be the same, thus, the right piecewise function for it should be like the following instead. $$l_n = \begin{cases} x_n, & \text{if}\; y_n = 1,\\ \max \{0, margin- x_n\}, & \text{if}\; y_n = -1, \end{cases}$$ Pull Request resolved: https://github.com/pytorch/pytorch/pull/95140 Approved by: https://github.com/albanD
Author
Committer
Parents
Loading