def autocorr_calculation(x: Tensor, lag: int) -> Tensor:
    y1 = x[:(len(x) - lag)]
    y2 = x[lag:]
    sum_product = ((y1 - x.mean(dim=0).expand(y1.size())) * (y2 - x.mean(dim=0).expand(y2.size()))).sum(0)
    return (sum_product / ((len(x) - lag) * torch.var(x, dim=0)))
def autocorr_calculation(x: Tensor, lag: int) -> Tensor:
    y1 = x[:(len(x) - lag)]
    y2 = x[lag:]
    sum_product = ((y1 - x.mean(dim=0).expand(y1.size())) * (y2 - x.mean(dim=0).expand(y2.size()))).sum(0)
    return (sum_product / ((len(x) - lag) * torch.var(x, dim=0)))