Skip to content

Distributed

GlobalParameter

Bases: AbstractGate

Source code in src/squint/ops/distributed.py
class GlobalParameter(AbstractGate):
    ops: Sequence[AbstractGate]
    weights: ArrayLike

    @beartype
    def __init__(
        self,
        ops: Sequence[AbstractGate],
        weights: ArrayLike,
    ):
        # if not len(ops) and weights.shape[0]
        wires = [wire for op in ops for wire in op.wires]
        super().__init__(wires=wires)
        self.ops = ops
        self.weights = paramax.non_trainable(weights)

    def unwrap(self):
        """Unwraps the shared ops for compilation and contractions."""
        return self.ops

unwrap()

Unwraps the shared ops for compilation and contractions.

Source code in src/squint/ops/distributed.py
def unwrap(self):
    """Unwraps the shared ops for compilation and contractions."""
    return self.ops