Solved by eduardo4jesus in post #4 
              
              
                Here is a solution by swag2198 from stackoverflow. 
>>> N = 5
>>> vals = torch.arange(N*(N+1)/2) + 1
 
>>> A = torch.zeros(N, N)
>>> i, j = torch.triu_indices(N, N)
>>> A[i, j] = vals
>>> A.T[i, j] = vals
  
>>> vals
 tensor([ 1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10., 11., 12., 13., 14.,
    …