pub fn quat_normalize<const D: usize>(q: Tensor<D>) -> Tensor<D>Expand description
Normalise quaternions to unit norm along the last axis (shape [..., 4]).
The per-step rotation is materialised from a raw, unconstrained projection
and normalised here so it is a genuine unit quaternion (an element of
SU(2)), the analogue of tanh(θ)·π bounding the RoPE angle. A tiny floor
guards the zero-quaternion.