This is a pre-release version (latest).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy latest / scipy / _lib / _array_api / xp_result_device

function

scipy._lib._array_api:xp_result_device

source: build-install/usr/lib/python3.14/site-packages/scipy/_lib/_array_api.py:594

Signature

def xp_result_device(*args)

Summary

Return the device for the result of a function with inputs args,

Extended Summary

The purpose of this function is to be used for input-output device propagation.

Arguments that do not carry a device - python scalars, NumPy arrays and scalars (host data), and arrays of backends without a .device attribute - do not determine the result device and are skipped: the device of the first device-carrying argument is returned (combining arrays across devices raises inside the backend anyway). Return None if no argument carries a device; creation functions then use the backend's default device, which is the correct result device for NumPy and for purely host-data inputs.

Aliases

  • scipy.differentiate.xp_result_device