dpctl.tensor.logsumexp¶
- dpctl.tensor.logsumexp(x, /, *, axis=None, dtype=None, keepdims=False, out=None)[source]¶
Calculates the logarithm of the sum of exponentials of elements in the input array
x
.- Parameters:
x (usm_ndarray) – input array.
axis (Optional[int, Tuple[int, ...]]) – axis or axes along which values must be computed. If a tuple of unique integers, values are computed over multiple axes. If
None
, the result 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-valued floating-point data type, the returned array will have the same data type asx
.If
x
has a boolean or integral data type, the returned array will have the default floating point data type for the device where input arrayx
is allocated.If
x
has a complex-valued floating-point data type, an error is raised.
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 result. 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, ifFalse
, 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
. IfNone
then a new array is returned. Default:None
.
- Returns:
an array containing the results. If the result 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: