astx.tensor
astx.tensor
Source: packages/astx/src/astx/tensor.py
title: ASTx Tensor AST nodes.
summary: >-
Provide internal nodes for the Arrow C++ backed tensor runtime, aligned with
Apache Arrow's homogeneous N-dimensional tensor model.Classes
TensorType(AnyType)
title: Internal Tensor semantic type.
summary: >-
Represent the homogeneous N-dimensional tensor abstraction while reusing
the canonical buffer/view representation during lowering.
attributes:
element_type:
type: astx.DataType | None
shape:
type: tuple[int, Ellipsis] | NoneTensorLiteral(astx.base.DataType)
title: Internal Arrow C++ backed Tensor literal node.
summary: >-
Build one Arrow C++ tensor value from scalar values plus shape and stride
metadata.
attributes:
values:
type: list[astx.AST]
element_type:
type: astx.DataType
shape:
type: tuple[int, Ellipsis]
strides:
type: tuple[int, Ellipsis] | None
offset_bytes:
type: int
type_:
type: TensorTypeMethods
get_struct(self, simplified: bool=False) -> astx.base.ReprStruct
title: Return the structured representation of the Tensor literal.
parameters:
simplified:
type: bool
returns:
type: astx.base.ReprStructTensorView(astx.base.DataType)
title: Internal Tensor view node.
summary: >-
Build one shallow tensor view by reusing the base storage and replacing
the logical shape, strides, and offset metadata.
attributes:
base:
type: astx.AST
shape:
type: tuple[int, Ellipsis]
strides:
type: tuple[int, Ellipsis] | None
offset_bytes:
type: int
type_:
type: TensorTypeMethods
get_struct(self, simplified: bool=False) -> astx.base.ReprStruct
title: Return the structured representation of the Tensor view.
parameters:
simplified:
type: bool
returns:
type: astx.base.ReprStructTensorIndex(astx.base.DataType)
title: Internal Tensor indexed read.
attributes:
base:
type: astx.AST
indices:
type: list[astx.AST]
type_:
type: astx.DataTypeMethods
get_struct(self, simplified: bool=False) -> astx.base.ReprStruct
title: Return the structured representation of the indexed read.
parameters:
simplified:
type: bool
returns:
type: astx.base.ReprStructTensorStore(astx.base.DataType)
title: Internal Tensor indexed store.
summary: >-
Stores one scalar through tensor shape and stride metadata. Arrow C++
backed tensors remain readonly in this phase, but the node keeps the
surface aligned with future writable views.
attributes:
base:
type: astx.AST
indices:
type: list[astx.AST]
value:
type: astx.AST
type_:
type: astx.Int32Methods
get_struct(self, simplified: bool=False) -> astx.base.ReprStruct
title: Return the structured representation of the indexed store.
parameters:
simplified:
type: bool
returns:
type: astx.base.ReprStructTensorNDim(astx.base.DataType)
title: Internal Tensor rank query.
attributes:
base:
type: astx.AST
type_:
type: astx.Int32Methods
get_struct(self, simplified: bool=False) -> astx.base.ReprStruct
title: Return the structured representation of the rank query.
parameters:
simplified:
type: bool
returns:
type: astx.base.ReprStructTensorShape(astx.base.DataType)
title: Internal Tensor shape-entry query.
attributes:
base:
type: astx.AST
axis:
type: int
type_:
type: astx.Int64Methods
get_struct(self, simplified: bool=False) -> astx.base.ReprStruct
title: Return the structured representation of the shape query.
parameters:
simplified:
type: bool
returns:
type: astx.base.ReprStructTensorStride(astx.base.DataType)
title: Internal Tensor stride-entry query.
attributes:
base:
type: astx.AST
axis:
type: int
type_:
type: astx.Int64Methods
get_struct(self, simplified: bool=False) -> astx.base.ReprStruct
title: Return the structured representation of the stride query.
parameters:
simplified:
type: bool
returns:
type: astx.base.ReprStructTensorElementCount(astx.base.DataType)
title: Internal Tensor element-count query.
attributes:
base:
type: astx.AST
type_:
type: astx.Int64Methods
get_struct(self, simplified: bool=False) -> astx.base.ReprStruct
title: Return the structured representation of the element-count query.
parameters:
simplified:
type: bool
returns:
type: astx.base.ReprStructTensorByteOffset(astx.base.DataType)
title: Internal Tensor byte-offset query for indexed addressing.
attributes:
base:
type: astx.AST
indices:
type: list[astx.AST]
type_:
type: astx.Int64Methods
get_struct(self, simplified: bool=False) -> astx.base.ReprStruct
title: Return the structured representation of the byte-offset query.
parameters:
simplified:
type: bool
returns:
type: astx.base.ReprStructTensorRetain(astx.base.DataType)
title: Internal explicit retain for Tensor-backed storage.
attributes:
base:
type: astx.AST
type_:
type: astx.Int32Methods
get_struct(self, simplified: bool=False) -> astx.base.ReprStruct
title: Return the structured representation of the retain helper.
parameters:
simplified:
type: bool
returns:
type: astx.base.ReprStructTensorRelease(astx.base.DataType)
title: Internal explicit release for Tensor-backed storage.
attributes:
base:
type: astx.AST
type_:
type: astx.Int32Methods
get_struct(self, simplified: bool=False) -> astx.base.ReprStruct
title: Return the structured representation of the release helper.
parameters:
simplified:
type: bool
returns:
type: astx.base.ReprStruct