Skip to content

.deferred()

Create an unrealized tensor that defers computation to .realize().

Used internally by _create_op_result when lazy mode is active. The tensor is a shell — values is None and shape is known — until .realize() walks the graph and calls forward_fn.

Parameters:

  • forward_fn (Callable[[], ndarray]) –

    Zero-argument callable that returns a backend ndarray. Captures input tensors by reference, so it stays valid until .realize() populates their .values.

  • shape (tuple) –

    Output shape. Available immediately without executing the op.

  • dtype (str, default: 'float32' ) –

    Data type string. Defaults to "float32".

  • device (str | None, default: None ) –

    Device string. Defaults to the current global default device.

Returns:

  • 'Tensor'

    An unrealized Tensor with values=None.