from_dlpack#

ivy.from_dlpack(x, /, *, out=None)[source]#

Return a new array containing the data from another (array) object with a __dlpack__ method or PyCapsule Object.

Parameters:
  • object (x) – input (array) object with a __dlpack__ method or PyCapsule Object.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – an array containing the data in x.

Note

The returned array may be either a copy or a view. See data-interchange for details.

This function conforms to the Array API Standard. This docstring is an extension of the docstring in the standard.

Both the description and the type hints above assumes an array input for simplicity, but this function is nestable, and therefore also accepts ivy.Container instances in place of any of the arguments.

Array.from_dlpack(self, /, *, out=None)[source]#

ivy.Array instance method variant of ivy.from_dlpack. This method simply wraps the function, and so the docstring for ivy.from_dlpack also applies to this method with minimal changes.

Parameters:
  • self (Array) – input array.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – an array containing the data in self.

Container.from_dlpack(self, /, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, *, out=None)[source]#
Return type:

Container