@@ -35,39 +35,3 @@ def make_entangler(kind: str, n_wires: int, trainable: bool=False, wire_reverse:
3535 # }
3636
3737 return EntanglementLayer (op = op_cls , n_wires = n_wires , kind = kind , has_params = op_has_params , trainable = trainable , wire_reverse = wire_reverse )
38- # # Prefer the dedicated entanglement module if available; otherwise use stable aliases.
39- # if kind == "full":
40- # from torchquantum.layer.entanglement import EntangleFull
41- # return EntangleFull(op=op_cls, n_wires=n_wires, has_params=op_has_params)
42-
43-
44- # if kind == "circular":
45- # # nearest-neighbor ring
46- # from torchquantum.layer.entanglement import EntangleCircular
47- # return EntangleCircular(op=op_cls, n_wires=n_wires, has_params=op_has_params)
48-
49- # if kind == "butterfly":
50- # from torchquantum.layer.entanglement.op2_layer import Op2QButterflyLayer
51- # return Op2QButterflyLayer(op=op_cls, n_wires=n_wires, has_params=op_has_params)
52-
53- # if kind == "pairwise":
54- # try:
55- # from torchquantum.layer.entanglement import EntanglePairwise
56- # return EntanglePairwise(op=op_cls, n_wires=n_wires, has_params=op_has_params)
57- # except Exception:
58- # # Fallback: (0,1), (2,3), ...
59- # class PairwiseFallback(tq.QuantumModule):
60- # def __init__(self):
61- # super().__init__()
62- # self.ops = nn.ModuleList()
63- # for a in range(0, n_wires - 1, 2):
64- # self.ops.append(op_cls(has_params=op_has_params, trainable=op_has_params))
65- # # store the pair alongside the op
66- # self.ops[-1].__pair__ = [a, a + 1]
67- # @tq.static_support
68- # def forward(self, qdev: tq.QuantumDevice):
69- # for op in self.ops:
70- # op(qdev, wires=op.__pair__)
71- # return PairwiseFallback()
72-
73- # raise ValueError(f"Unknown entanglement kind '{kind}'")
0 commit comments