Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

591 B
Raw Blame

tversky_loss and TverskyLoss raise TypeError when target is not a tensor; it used to be an AttributeError, or a misleading device-mismatch ValueError for a NumPy array. They raise ValueError when alpha, beta or eps is a Python int or float that is negative, infinite or NaN (TverskyLoss at construction): a NaN weight returned a NaN loss, a negative one returned a meaningless loss (alpha=-0.5 could give a loss below 0), and an infinite one returned 1. Tensor-valued alpha, beta and eps, including one weight per class, are not checked and work as before.