inner(tensor1, tensor2, n_modes=None)[source]

Generalised inner products between tensors

Takes the inner product between the last (respectively first) n_modes of tensor1 (respectively tensor2)


tensor1, tensor2 : tensor

n_modes : int, default is None

  • if None, the traditional inner product is returned (i.e. a float)

  • otherwise, the product between the n_modes last modes of tensor1

    and the n_modes first modes of tensor2 is returned. The resulting tensor’s order is ndim(tensor1) - n_modes.


inner_product : float if n_modes is None, tensor otherwise