def METHOD_NAME(dim):
    mat = ComplexTensor(torch.rand(2, 3, 4), torch.rand(2, 3, 4))
    mat_th = torch.complex(mat.real, mat.imag)
    norm = complex_norm(mat, dim=dim, keepdim=True)
    norm_th = complex_norm(mat_th, dim=dim, keepdim=True)
    assert torch.allclose(norm, norm_th)
    if dim is not None:
        assert norm.ndim == mat.ndim and mat.numel() == norm.numel() * mat.size(dim)