warp.fem.borrow_temporary#

warp.fem.borrow_temporary(
temporary_store,
shape,
dtype,
pinned=False,
requires_grad=False,
device=None,
)[source]#

Borrows and returns a temporary array with specified attributes from a shared pool.

If an array with sufficient capacity and matching desired attributes is already available in the pool, it will be returned. Otherwise, a new allocation will be performed.

Parameters:
  • temporary_store (TemporaryStore | None) – the shared pool to borrow the temporary from. If temporary_store is None, the global default temporary store, if set, will be used.

  • shape (int | tuple[int]) – desired dimensions for the temporary array

  • dtype (type) – desired data type for the temporary array

  • pinned (bool) – whether a pinned allocation is desired

  • device – device on which the memory should be allocated; if None, the current device will be used.

  • requires_grad (bool)

Return type:

array