Arrays¶
Advect preserves the provider selected by traced inputs.
array and asarray are
construction helpers for live tracers and rectangular nested tracer sequences.
Ordinary NumPy code can keep using NumPy constructors, including like=
dispatch. Use
is_traced only when code genuinely needs to
distinguish a live trace, and
stop_gradient to remove one dependency
explicitly.
For Array API inputs, a dynamic call selects the newest supported revision common to every input. Mixed providers fail. Staging records one explicit revision in the program rather than inferring a minimum from the operations used. See the NumPy frontend, pytree utilities, and support catalog for their separate public contracts.
array ¶
Construct an owned array while preserving traced dependencies.
This is the explicit traced counterpart of the common
numpy.array(obj, dtype=..., copy=...) forms. It intentionally does not
mirror NumPy's complete constructor signature.
Examples:
asarray ¶
Construct an array without detaching Advect tracers.
Direct tracers and rectangular nested tracer sequences remain
differentiable. This is the provider-neutral explicit alternative to
NumPy's standard numpy.asarray(..., like=tracer) dispatch. Ordinary
non-traced values retain their provider when they expose the pinned Array
API namespace and otherwise use NumPy.
Examples:
is_traced ¶
Return whether value is an Advect tracer.
This check does not read the trace-time payload and remains safe for an escaped tracer. It tests the value itself rather than recursively searching an arbitrary object graph.
Examples:
stop_gradient ¶
Return a concrete copy of traced leaves, explicitly stopping gradients.
Registered pytree structure is preserved. The operation is available only during concrete dynamic tracing; staging rejects it because an abstract value has no concrete primal to validate or serialize.
Examples:
$ █