mode_dot#

ivy.mode_dot(x, /, matrix_or_vector, mode, transpose=False, *, out=None)[source]#

N-mode product of a tensor and a matrix or vector at the specified mode.

Parameters:
  • x (Union[Array, NativeArray]) – tensor of shape (i_1, ..., i_k, ..., i_N)

  • matrix_or_vector (Union[Array, NativeArray]) – 1D or 2D array of shape (J, i_k) or (i_k, ) matrix or vectors to which to n-mode multiply the tensor

  • mode (int) – int in the range(1, N)

  • transpose (Optional[bool], default: False) – If True, the matrix is transposed. For complex tensors, the conjugate transpose is used.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the result can broadcast to.

Return type:

Array

Returns:

ivy.Arraymode-mode product of tensor by matrix_or_vector * of shape \((i_1, ..., i_{k-1}, J, i_{k+1}, ..., i_N)\)

if matrix_or_vector is a matrix

  • of shape \((i_1, ..., i_{k-1}, i_{k+1}, ..., i_N)\) if matrix_or_vector is a vector

Array.mode_dot(self, /, matrix_or_vector, mode, transpose=False, *, out=None)[source]#

ivy.Array instance method variant of ivy.mode_dot. This method simply wraps the function, and so the docstring for ivy.mode_dot also applies to this method with minimal changes.

Parameters:
  • self (Union[Array, NativeArray]) – tensor of shape (i_1, ..., i_k, ..., i_N)

  • matrix_or_vector (Union[Array, NativeArray]) – 1D or 2D array of shape (J, i_k) or (i_k, ) matrix or vectors to which to n-mode multiply the tensor

  • mode (int) – int in the range(1, N)

  • transpose (Optional[bool], default: False) – If True, the matrix is transposed. For complex tensors, the conjugate transpose is used.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the result can broadcast to.

Return type:

Array

Returns:

ivy.Arraymode-mode product of tensor by matrix_or_vector * of shape \((i_1, ..., i_{k-1}, J, i_{k+1}, ..., i_N)\) if matrix_or_vector is a matrix * of shape \((i_1, ..., i_{k-1}, i_{k+1}, ..., i_N)\) if matrix_or_vector is a vector

Container.mode_dot(self, /, matrix_or_vector, mode, transpose=False, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#

ivy.Container instance method variant of ivy.mode_dot. This method simply wraps the function, and so the docstring for ivy.mode_dot also applies to this method with minimal changes.

Parameters:
  • x – tensor of shape (i_1, ..., i_k, ..., i_N)

  • matrix_or_vector (Union[Array, NativeArray, Container]) – 1D or 2D array of shape (J, i_k) or (i_k, ) matrix or vectors to which to n-mode multiply the tensor

  • mode (Union[int, Container]) – int in the range(1, N)

  • transpose (Optional[Union[bool, Container]], default: False) – If True, the matrix is transposed. For complex tensors, the conjugate transpose is used.

  • out (Optional[Container], default: None) – optional output array, for writing the result to. It must have a shape that the result can broadcast to.

Returns:

ivy.Containermode-mode product of tensor by matrix_or_vector * of shape \((i_1, ..., i_{k-1}, J, i_{k+1}, ..., i_N)\) if matrix_or_vector is a matrix * of shape \((i_1, ..., i_{k-1}, i_{k+1}, ..., i_N)\) if matrix_or_vector is a vector