Skip to content

Constant

Constant Manual

Overview

The constant codec encodes a single numeric input with constant elements. It succeeds only if all elements in the input have the same value, compressing it into a single element and a varint representing the number of repetitions written to a header.

Inputs

A single numeric typed input.

Outputs

A single numeric typed output with a single element.

Use Cases

Used for deduplicating constant valued inputs and compress such inputs effectively.

openzl.ext.graphs.Constant

Bases: Graph

Encode a constant input as a singleton value and size pair

Inputs: constant data: TypeMask.Serial | TypeMask.Struct

Source code in build-openzl/py/site-packages/openzl/ext/graphs.pyi
class Constant(Graph):
    """
    Encode a constant input as a singleton value and size pair

    Inputs:
    constant data: TypeMask.Serial | TypeMask.Struct
    """

    def __init__(self) -> None: ...

    def __call__(self, arg: ext.Compressor, /) -> ext.GraphID: ...

    def parameterize(self, compressor: ext.Compressor) -> ext.GraphID: ...

    def set_destination(self, edge: ext.Edge) -> None: ...

    def set_multi_input_destination(self, edges: Sequence[ext.Edge]) -> None: ...

    @property
    def base_graph(self) -> ext.GraphID: ...

base_graph property

__call__(arg)

Source code in build-openzl/py/site-packages/openzl/ext/graphs.pyi
def __call__(self, arg: ext.Compressor, /) -> ext.GraphID: ...

__init__()

Source code in build-openzl/py/site-packages/openzl/ext/graphs.pyi
def __init__(self) -> None: ...

parameterize(compressor)

Source code in build-openzl/py/site-packages/openzl/ext/graphs.pyi
def parameterize(self, compressor: ext.Compressor) -> ext.GraphID: ...

set_destination(edge)

Source code in build-openzl/py/site-packages/openzl/ext/graphs.pyi
def set_destination(self, edge: ext.Edge) -> None: ...

set_multi_input_destination(edges)

Source code in build-openzl/py/site-packages/openzl/ext/graphs.pyi
def set_multi_input_destination(self, edges: Sequence[ext.Edge]) -> None: ...