Skip to content

traits

AccessCapability

Marker for a way a level can be read or written.

Source code in src/finch/tensor/traits.py
 9
10
class AccessCapability:
    """Marker for a way a level can be read or written."""

Blocked dataclass

Bases: FormatProperty

Each non-fill slice at an odd position along the conclusion dimensions occurs together with a subsequent non-fill slice.

Source code in src/finch/tensor/traits.py
37
38
39
40
41
42
43
44
45
@dataclass(frozen=True)
class Blocked(FormatProperty):
    """
    Each non-fill slice at an odd position along the conclusion dimensions
    occurs together with a subsequent non-fill slice.
    """

    hypothesis_dims: tuple[int, ...]
    conclusion_dims: tuple[int, ...]

Dense dataclass

Bases: FormatProperty

Every slice identified by dims contains a non-fill value.

Equivalently, the tensor's non-fill support has a complete projection onto these dimensions.

Source code in src/finch/tensor/traits.py
25
26
27
28
29
30
31
32
33
34
@dataclass(frozen=True)
class Dense(FormatProperty):
    """
    Every slice identified by ``dims`` contains a non-fill value.

    Equivalently, the tensor's non-fill support has a complete projection onto
    these dimensions.
    """

    dims: tuple[int, ...]

FormatProperty

Marker for a structural property exposed by a tensor format.

Source code in src/finch/tensor/traits.py
21
22
class FormatProperty:
    """Marker for a structural property exposed by a tensor format."""

Random

Bases: AccessCapability

The level supports direct access by index.

Source code in src/finch/tensor/traits.py
17
18
class Random(AccessCapability):
    """The level supports direct access by index."""

Repeated dataclass

Bases: FormatProperty

Each slice at an odd position along the conclusion dimension occurs together with an subsequent identical slice.

Source code in src/finch/tensor/traits.py
48
49
50
51
52
53
54
55
56
@dataclass(frozen=True)
class Repeated(FormatProperty):
    """
    Each slice at an odd position along the conclusion dimension occurs together
    with an subsequent identical slice.
    """

    hypothesis_dims: tuple[int, ...]
    conclusion_dims: tuple[int, ...]

Sequential

Bases: AccessCapability

The level supports ordered traversal.

Source code in src/finch/tensor/traits.py
13
14
class Sequential(AccessCapability):
    """The level supports ordered traversal."""