def _matrix_normalize(input: Tensor,
dim: int
) -> Tensor:
"""
Center and normalize according to the forbenius norm (not the standard deviation).
Warning: this does not create standardized random variables in a random vectors.
Note: careful with this, it makes CCA behave in unexpected ways
:param input:
:param dim:
:return:
"""
from torch.linalg import norm
return (input - input.mean(dim=dim, keepdim=True)) / norm(input, 'fro')
do: