tensorly.tenalg.inner

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)

Parameters:
tensor1, tensor2tensor
n_modesint, 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.

Returns:
inner_productfloat if n_modes is None, tensor otherwise