set_default_device#

ivy.set_default_device(device, /)[source]#

Sets the default device to the argument provided in the function.

Parameters:

device (Union[Device, NativeDevice]) – The device to be set as the default device.

Return type:

None

Returns:

ret – The new default device.

Examples

>>> ivy.default_device()
'cpu'
>>> ivy.set_backend('jax')
>>> ivy.set_default_device('gpu:0')
>>> ivy.default_device()
'gpu:0'
>>> ivy.set_backend('torch')
>>> ivy.set_default_device('gpu:1')
>>> ivy.default_device()
'gpu:1
>>> ivy.set_backend('tensorflow')
>>> ivy.set_default_device('tpu:0)
>>> ivy.default_device()
'tpu:0
>>> ivy.set_backend('paddle')
>>> ivy.set_default_device('cpu)
>>> ivy.default_device()
'cpu'
>>> ivy.set_backend('mxnet')
>>> ivy.set_default_device('cpu')
>>> ivy.default_device()
'cpu'