dpctl.tensor.prod

dpctl.tensor.prod(x, /, *, axis=None, dtype=None, keepdims=False, out=None)[source]

Calculates the product of elements in the input array x.

Parameters:
  • x (usm_ndarray) – input array.

  • axis (Optional[int, Tuple[int, ...]]) – axis or axes along which products must be computed. If a tuple of unique integers, products are computed over multiple axes. If None, the product is computed over the entire array. Default: None.

  • dtype (Optional[dtype]) –

    data type of the returned array. If None, the default data type is inferred from the “kind” of the input array data type.

    • If x has a real- or complex-valued floating-point data type, the returned array will have the same data type as x.

    • If x has signed integral data type, the returned array will have the default signed integral type for the device where input array x is allocated.

    • If x has unsigned integral data type, the returned array will have the default unsigned integral type for the device where input array x is allocated.

    • If x has a boolean data type, the returned array will have the default signed integral type for the device where input array x is allocated.

    If the data type (either specified or resolved) differs from the data type of x, the input array elements are cast to the specified data type before computing the product. Default: None.

  • keepdims (Optional[bool]) – if True, the reduced axes (dimensions) are included in the result as singleton dimensions, so that the returned array remains compatible with the input arrays according to Array Broadcasting rules. Otherwise, if False, the reduced axes are not included in the returned array. Default: False.

  • out (Optional[usm_ndarray]) – the array into which the result is written. The data type of out must match the expected shape and the expected data type of the result or (if provided) dtype. If None then a new array is returned. Default: None.

Returns:

an array containing the products. If the product was computed over the entire array, a zero-dimensional array is returned. The returned array has the data type as described in the dtype parameter description above.

Return type:

usm_ndarray