Let there be tensors A and B
A = Outer[Times, {1, 0}, {2, 0}]
B = Grad[{f[x, y], g[x, y]}, {x, y}]
with output
{{2, 0}, {0, 0}}
{{(f^(1,0))[x,y],(f^(0,1))[x,y]},{(g^(1,0))[x,y],(g^(0,1))[x,y]}}
Now, I am looking for tensor contraction of A and B ($A:B$) as follows
TensorContract[A, B]
Which produces output
TensorContract::contr: Invalid contraction {(f^(1,0))[x,y],(f^(0,1))[x,y]}.
How can get the correct result, in this case $2\frac{\partial f}{\partial x}$?
Total[A B,2]
orTensorContract[TensorProduct[A, B], {{1, 3}, {2, 4}}]
. $\endgroup$