https://github.com/surban/TensorAlgDiff/raw/master/elemdiff....
Our system takes a tensor algebra (we call it element-wise defined tensor) and outputs expressions for the derivatives w.r.t. all of its arguments. The expression may contain sums and the indices of the argument tensors can be any linear combination of the function indices (see our example for more details). It correctly handles the cases where an index does not appear in an argument, appears twice, appears as (i+j) etc.
Code to play with at https://github.com/surban/TensorAlgDiff