import torch


def mpjae(predicted, target):
    """
    Mean per-joint angle error (3d bone vector angle error between gt and predicted one)
    """
    assert predicted.shape == target.shape  # [B,T, K]
    joint_error = torch.mean(torch.abs(predicted - target).cuda(), dim=0)  # Calculate each joint angle
    print('each bone angle error:', joint_error)
    return torch.mean(joint_error)