tensorly.tenalg.contract

contract(tensor1, modes1, tensor2, modes2)[source]

Tensor contraction between two tensors on specified modes

Parameters:

tensor1 : tl.tensor

modes1 : int list or int

modes on which to contract tensor1

tensor2 : tl.tensor

modes2 : int list or int

modes on which to contract tensor2

Returns:

contraction : tensor1 contracted with tensor2 on the specified modes