title: Replace diagonal elements with vector in PyTorch
body: <p>I have been searching everywhere for something equivalent of the following to PyTorch, but I cannot find anything.</p>
  
  <pre><code>L_1 = np.tril(np.random.normal(scale=1., size=(D, D)), k=0)
  L_1[np.diag_indices_from(L_1)] = np.exp(np.diagonal(L_1))
  </code></pre>
  
  <p>I guess there is no way to replace the diagonal elements in such an elegant way using Pytorch.</p>