arx.tensor
arx.tensor
Source: packages/arx/src/arx/tensor.py
title: Tensor surface helpers for Arx.
summary: >-
Adapt Arx surface tensor syntax to IRx Tensor nodes while keeping user-facing
shape and indexing rules local to Arx.Functions
is_tensor_type(data_type: astx.DataType | None) -> bool
title: Return whether one type is an Arx tensor surface type.
parameters:
data_type:
type: astx.DataType | None
returns:
type: booltensor_shape(data_type: astx.DataType | None) -> tuple[int, ...] | None
title: Return the declared tensor shape when available.
parameters:
data_type:
type: astx.DataType | None
returns:
type: tuple[int, Ellipsis] | Nonetensor_type(element_type: astx.DataType, shape: tuple[int, ...]) -> astx.TensorType
title: Build one static-shape tensor surface type.
parameters:
element_type:
type: astx.DataType
shape:
type: tuple[int, Ellipsis]
returns:
type: astx.TensorTyperuntime_tensor_type(element_type: astx.DataType) -> astx.TensorType
title: Build one runtime-shaped tensor surface type.
parameters:
element_type:
type: astx.DataType
returns:
type: astx.TensorTypebinding_from_type(data_type: astx.DataType | None) -> TensorBinding | None
title: Build one static tensor binding from one declared type.
parameters:
data_type:
type: astx.DataType | None
returns:
type: TensorBinding | Noneattach_binding(node: astx.AST, binding: TensorBinding) -> None
title: Attach static tensor metadata to one AST node.
parameters:
node:
type: astx.AST
binding:
type: TensorBindingcoerce_expression(expr: astx.Expr, target_type: astx.DataType, *, context: str) -> astx.Expr
title: Coerce one parsed expression into one declared tensor type.
parameters:
expr:
type: astx.Expr
target_type:
type: astx.DataType
context:
type: str
returns:
type: astx.Exprdefault_value(target_type: astx.DataType) -> astx.TensorLiteral
title: Build one default tensor literal for one declared type.
parameters:
target_type:
type: astx.DataType
returns:
type: astx.TensorLiteralbuild_literal_from_literal(expr: astx.Literal, target_type: astx.DataType, *, context: str) -> astx.TensorLiteral
title: Build one tensor literal from one nested literal value.
parameters:
expr:
type: astx.Literal
target_type:
type: astx.DataType
context:
type: str
returns:
type: astx.TensorLiteralinfer_literal(expr: astx.Literal) -> astx.TensorLiteral
title: Infer one tensor literal directly from one literal value.
parameters:
expr:
type: astx.Literal
returns:
type: astx.TensorLiteralliteral_values(node: astx.TensorLiteral) -> tuple[astx.AST, ...]
title: Return one flattened scalar payload from a tensor literal.
parameters:
node:
type: astx.TensorLiteral
returns:
type: tuple[astx.AST, Ellipsis]Classes
TensorBinding
title: Static tensor binding metadata.
attributes:
element_type:
type: astx.DataType
layout:
type: TensorLayout
flags:
type: int