warp.zeros_like#

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

Return a zero-initialized array with the same type and dimension of another array.

Parameters:
  • src (Array) – The template array to use for shape, data type, and device

  • 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