Add Hinge, Huber and LogCosh losses (#199)

This commit is contained in:
Nicholas Santavas
2023-12-22 19:28:10 +01:00
committed by GitHub
parent e8deca84e0
commit d35fa1db41
4 changed files with 117 additions and 3 deletions

View File

@@ -123,7 +123,7 @@ To get more detailed information on the arrays in a :class:`Module` you can use
all the parameters in a :class:`Module` do:
.. code-block:: python
from mlx.utils import tree_map
shapes = tree_map(lambda p: p.shape, mlp.parameters())
@@ -131,7 +131,7 @@ As another example, you can count the number of parameters in a :class:`Module`
with:
.. code-block:: python
from mlx.utils import tree_flatten
num_params = sum(v.size for _, v in tree_flatten(mlp.parameters()))

View File

@@ -16,4 +16,7 @@ Loss Functions
mse_loss
nll_loss
smooth_l1_loss
triplet_loss
triplet_loss
hinge_loss
huber_loss
log_cosh_loss