import torch


def spher2cart(theta: torch.Tensor, phi: torch.Tensor):
    """Convert spherical coordinates into Cartesian coordinates on unit sphere."""
    x = torch.sin(theta) * torch.cos(phi)
    y = torch.sin(theta) * torch.sin(phi)
    z = torch.cos(theta)
    return torch.stack([x, y, z], dim=-1)