Spaces:
Sleeping
Sleeping
File size: 1,315 Bytes
9146d63 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # src/optimizer/losses.py
import torch
def rosenbrock_3d(u: torch.Tensor) -> torch.Tensor:
"""
3D Rosenbrock function, commonly used as a challenging non-convex benchmark.
The global minimum is at (x, y, z) = (1, 1, 1) with value 0.
When composed with stereographic projection from S^3 → R^3, it creates a compactified
landscape with narrow valleys and pole singularities — ideal for testing manifold optimizers.
Args:
u: Tensor of shape (... , 3) representing points in R^3
Returns:
loss: Tensor of shape (... ,) with the Rosenbrock values
"""
x, y, z = u[..., 0], u[..., 1], u[..., 2]
return 100.0 * (y - x**2)**2 + 100.0 * (z - y**2)**2 + (1.0 - x)**2
# Future-proof placeholders for additional benchmark losses
# ------------------------------------------------------------------
# def brockett_function(...):
# """Brockett function on the Stiefel manifold — another classic Riemannian test."""
# ...
#
# def hyperbolic_embedding_loss(...):
# """Example loss for tree-like data in the Poincaré ball."""
# ...
#
# def sphere_direction_statistics_loss(...):
# """Von Mises-Fisher or other directional statistics objectives."""
# ...
# ------------------------------------------------------------------
|