input
import torch
import math
a = torch.tensor([2, 3, 4], dtype=torch.float32)
b = torch.tensor([2, 3, 4], dtype=torch.float32)
cos_alpha = a@b/(torch.sqrt(torch.sum(torch.pow(a, 2)))*torch.sqrt(torch.sum(torch.pow(b, 2))))
print(cos_alpha)
print(torch.acos(cos_alpha))
output
tensor(1.)
tensor(0.)