copy_array
- arrayfire.copy_array(array: Array, /) Array
Performs a deep copy of the given ArrayFire array.
This function creates a new ArrayFire array that is an identical copy of the input array. It ensures that the new array is a separate instance with its own memory, independent of the original array.
Parameters
- arrayArray
The input ArrayFire array to be copied.
Returns
- Array
A new ArrayFire array that is an identical copy of the input array. This copy is independent of the original, allowing for modifications without affecting the original array.
Example
>>> import arrayfire as af >>> original_array = af.randu((3, 3)) # Create a random 3x3 array >>> copied_array = af.copy_array(original_array) # Make a deep copy of the original array >>> original_array == copied_array [3 3 1 1] 1 1 1 1 1 1 1 1 1
>>> original_array.arr == copied_array.arr False