I have looked Einsum.jl and TensorOperations.jl to replicate following behavior np.einsum:

https://docs.scipy.org/doc/numpy/reference/generated/numpy.einsum.html

Views returned from einsum are now writeable whenever the input array is writeable. For example, `np.einsum('ijk...->kji...', a)`

will now have the same effect as `np.swapaxes(a, 0, 2)`

and `np.einsum('ii->i', a)`

will return a writeable view of the diagonal of a 2D array.

This seems not yet possible also I took a look @views but that seemed cumber some too. Any suggestions? The main questions is how to define views of various digaonal and populate various diagonals in a tensor?