function_supported_devices#

ivy.function_supported_devices(fn, recurse=True)[source]#

Return the supported devices of the current backend’s function. The function returns a dict containing the supported devices for the compositional and primary implementations in case of partial mixed functions.

Parameters:
  • fn (Callable) – The function to check for the supported device attribute

  • recurse (bool, default: True) – Whether to recurse into used ivy functions. Default is True.

Return type:

Union[Tuple, dict]

Returns:

ret – Tuple or dict containing the supported devices of the function

Examples

>>> import ivy
>>> ivy.set_backend('numpy')
>>> print(ivy.function_supported_devices(ivy.ones))
('cpu',)
>>> ivy.set_backend('torch')
>>> x = ivy.function_supported_devices(ivy.ones)
>>> x = sorted(x)
('cpu', 'gpu')