pangolin.interface.Interface.constant

pangolin.interface.Interface.constant#

Interface.constant(value, /)[source]#

Create an interface RV representing a fixed numeric value.

value is normalized by pangolin.ir.Constant to an immutable NumPy array. Scalars remain scalar-shaped, while nested sequences and arrays retain their array shape.

Parameters:

value (ArrayLike) – A numeric scalar, sequence, NumPy array, JAX array, or other numeric array-like value.

Raises:

ValueError – If value is empty or does not have a numeric dtype.

Return type:

RV

Examples

>>> from pangolin import interface as pi
>>> pi.constant(7)
RV(Constant(7))
>>> x = pi.constant([[1, 2], [3, 4]])
>>> x.shape
(2, 2)