@tom Hi Thomas I have another question. When I tried the torch.nn.init.orthogonal_() like following:

# Python code to check  
# whether a matrix is  
# orthogonal or not 
  
def isOrthogonalN(a, m, n) : 
    if (m != n) : 
        return False
      
    # Multiply A*A^t 
    for i in range(0, n) : 
        for j in range(0, n) :  
            sum = 0
            for k in range(0, n) : 
          
                # Since we are multiplying  
                # with transpose of itself. 
                # We use a[j][k] instead 
                # of a[k][j] 
                sum = sum + (a[i][k] *
                             a[j][k]) 
          
        if (i == j and sum != 1) : 
            return False
        if (i != j and sum != 0) : 
            return False
  
    return True

a = torch.empty(3, 3)
a=torch.nn.init.orthogonal_(a)

if (isOrthogonalN(a, len(a), len(a[0]))) :
    print ("Yes") 
else : 
    print ("No") ```

I got as asnwer 

```NO``` 

When I tried with:

```a = [[1, 0, 0], 
    [0, 1, 0], 
    [0, 0, 1]]```

the answer was ```YES``` .

What do you think I am doing wrong here. I did not write myself the code ``isOrthogonal``` it is from ```GeeksforGeeks``` site.

Is there any function in PyTorch that I can use to check for orthogonality of matrices? 

Thank you in advance for your help.

Cheers.

Ergnoor