warp.utils.array_inner#

warp.utils.array_inner(a, b, out=None, count=None, axis=None)[source]#

Compute the inner product of two arrays.

This function computes the dot product between two arrays, optionally along a specified axis. The operation can be performed on the entire arrays or along a specific dimension.

During matching-device APIC graph capture, non-empty calls require an explicit out array so replay can store the current result. Existing whole-array, explicit-count, composite-dtype, and positive-stride axis reductions are recorded. Negative strides raise NotImplementedError during APIC capture. Counts and reduction strides must fit the native signed 32-bit ABI, and participating addresses and strides must be aligned to the scalar type.

Parameters:
  • a (array) – First input array.

  • b (array) – Second input array. Must match shape and type of a.

  • out (array | None) – Output array to store results. If None, a new array is created.

  • count (int | None) – Number of elements to process. If None, processes entire arrays.

  • axis (int | None) – Axis along which to compute inner product. If None, computes on flattened arrays.

Returns:

The inner product result. Returns a float if axis is None and out is None, otherwise returns the out array.

Raises:
  • RuntimeError – If array storage devices, sizes, or data types are incompatible, or if a matching-device APIC-captured call uses a count or layout that the native reduction ABI cannot represent.

  • NotImplementedError – If a non-empty call under matching-device APIC graph capture omits out. Also raised if any input or output array has a negative stride under matching-device APIC graph capture, including for a zero-count call.

Return type:

array | float