suppose variable a and b both with shape n * 3. then:
inner_product = (a * b).sum(dim=1)
a_norm = a.pow(2).sum(dim=1).pow(0.5)
b_norm = b.pow(2).sum(dim=1).pow(0.5)
cos = inner_product / (2 * a_norm * b_norm)
angle = torch.acos(cos)

Is it what you want ?