jax.lax.dot_general(lhs, rhs, dimension_numbers, precision=None, preferred_element_type=None)[source]¶

More general contraction operator.

Wraps XLA’s DotGeneral operator.

  • lhs (Any) – an array

  • rhs (Any) – an array

  • dimension_numbers (Tuple[Tuple[Sequence[int], Sequence[int]], Tuple[Sequence[int], Sequence[int]]]) – a tuple of tuples of the form ((lhs_contracting_dims, rhs_contracting_dims), (lhs_batch_dims, rhs_batch_dims))

  • precision (Union[None, str, Any, Tuple[str, str], Tuple[Any, Any]]) – Optional. Either None, which means the default precision for the backend, a lax.Precision enum value (Precision.DEFAULT, Precision.HIGH or Precision.HIGHEST) or a tuple of two lax.Precision enums indicating precision of lhs` and rhs.

  • preferred_element_type (Optional[Any]) – Optional. Either None, which means the default accumulation type for the input types, or a datatype, indicating to accumulate results to and return a result with that datatype.

Return type



An array containing the result.