add tensordot and copy template
tensordot outside for loop
two tensordot possible must find the fastest