tfep.utils.geometry.vector_vector_angle
- tfep.utils.geometry.vector_vector_angle(x1, x2)[source]
Return the angle in radians between a two vectors.
If both
x1andx2have multiple vectors, the angles are computed in a batchwise fashion.- Parameters:
x1 (torch.Tensor) – A tensor of shape
(*, D), whereDis the vector dimensionality.x2 (torch.Tensor) – A tensor of shape
(*, D), whereDis the vector dimensionality.
- Returns:
angles – A tensor of shape
(*,). As an example, if both inputs have shape(batch_size, D), thenangleshas shape(batch_size,)andangles[i]is the angle between vectorsx1[i]andx2[i].The angle is from 0 to pi.
- Return type:
torch.Tensor