Skip to content

TensorAttr dataclass

TensorAttr(
    group_name: Optional[str] = None,
    attr_name: Optional[str] = None,
    index: IndexType = None,
)

Identifies an array of a FeatureStore.

Parameters:

Name Type Description Default
group_name Optional[str]

Group of the array, e.g. a node type. None for homogeneous graphs.

None
attr_name Optional[str]

Name of the array, e.g. "x" (or "node_features"), "y", "time".

None
index IndexType

Rows to read or write: None (all), an integer, a slice, or an array of row indices.

None

Methods:

Name Description
cast

A TensorAttr from another one, a tuple

Attributes:

Name Type Description
key tuple[Optional[str], Optional[str]]

(group_name, attr_name), the key of the array.

key property

(group_name, attr_name), the key of the array.

cast classmethod

cast(*args: Any, **kwargs: Any) -> TensorAttr

A TensorAttr from another one, a tuple (group_name, attr_name[, index]) or keyword arguments.

Source code in mlx_graphs/data/feature_store.py
@classmethod
def cast(cls, *args: Any, **kwargs: Any) -> "TensorAttr":
    """A :class:`TensorAttr` from another one, a tuple
    ``(group_name, attr_name[, index])`` or keyword arguments."""
    if len(args) == 1 and not kwargs:
        value = args[0]
        if isinstance(value, TensorAttr):
            return value
        if isinstance(value, tuple):
            return cls(*value)
        if isinstance(value, dict):
            return cls(**value)
    return cls(*args, **kwargs)

from mlx_graphs.data import TensorAttr · mlx_graphs/data/feature_store.py