SegmentedOperand#

class cuequivariance.SegmentedOperand(
segments: list[tuple[int, ...]] | None = None,
*,
ndim: int | None = None,
_dims: dict[int, set[int]] | None = None,
)#

A segmented operand is a list of segment’s shapes.

classmethod empty_segments(
num_segments: int,
) SegmentedOperand#

Create an operand with ndim=0

classmethod stack(
operands: list[SegmentedOperand],
) SegmentedOperand#

Stack a list of operands together.

copy() SegmentedOperand#

Copy the operand.

assert_valid()#

Assert that the operand is valid.

insert_segment(index: int, segment: tuple[int, ...])#

Insert a segment at a given index.

add_segment(segment: tuple[int, ...]) int#

Add a segment to the operand.

property num_segments: int#

The number of segments in the operand.

property size: int#

The total size of the operand.

segment_slices() list[slice]#

Return slice object for each segment.

get_dimensions_dict() dict[int, set[int]]#

Return a dictionary of dimensions for each channel.

get_dims(i: int) set[int]#

Return the dimensions for a given channel.

all_same_segment_shape() bool#

Check if all segments have the same shape. Returns False if there are no segments.

property segment_shape: tuple[int, ...]#

The shape of the segments if they are all the same.

property segment_size: int#

The size of the segments if they are all the same.