Wrote overload of diag allowing it to be composed with other methods returning a TensorRef.