warp.clone#

warp.clone(
src,
device=None,
requires_grad=None,
pinned=None,
retain_grad=False,
)[source]#

Clone an existing array, allocating a copy of the src memory.

Parameters:
  • src (array) – The source array to copy

  • device (Device | str | None) – The device where the new array will be created (defaults to src.device)

  • requires_grad (bool | None) – Whether the array will be tracked for back propagation

  • pinned (bool | None) – Whether the array uses pinned host memory (only applicable to CPU arrays)

  • retain_grad (bool) – Whether to preserve gradients during backward instead of zeroing after read

Returns:

A warp.array object representing the allocation

Return type:

array