跳转至

pl.array

定长数组,主要用于把一个循环产生的 pl.TASK_ID 值带给之后的 deps=。见声明一条边

Array operations for PyPTO Language DSL.

Type-safe wrappers around the IR-level pypto.ir.op.array_ops that accept and return Array / Scalar wrappers.

Writes are SSA-functional: update_element(arr, i, v) returns a new Array representing the updated array, mirroring tensor.assemble.

create(extent, dtype)

Allocate an on-core array (C-stack local).

Parameters:

Name Type Description Default
extent int

Number of elements (positive Python int — compile-time constant).

required
dtype DataType

Element data type (must be integer or BOOL).

required

Returns:

Type Description
Array

Array wrapping the array.create Call expression.

get_element(array, index)

Read an element from an array at the given index.

Parameters:

Name Type Description Default
array Array

Source Array.

required
index IntLike

Element index (Python int, raw Expr, or Scalar DSL value).

required

Returns:

Type Description
Scalar

Scalar wrapping the array.get_element Call expression.

update_element(array, index, value)

Functional update: return a new Array with the given element replaced.

Parameters:

Name Type Description Default
array Array

Source Array.

required
index IntLike

Element index (Python int, raw Expr, or Scalar DSL value).

required
value IntLike

Replacement value (Python int, raw Expr, or Scalar DSL value).

required

Returns:

Type Description
Array

Array wrapping the array.update_element Call expression.