base
base
¤
CompiledCircuit = TypeVar('CompiledCircuit')
module-attribute
¤
InitializerCompilationSign = type[Initializer]
module-attribute
¤
LayerCompilationSign = type[Layer]
module-attribute
¤
ParameterCompilationSign = type[ParameterNode]
module-attribute
¤
SUPPORTED_BACKENDS = ['torch']
module-attribute
¤
AbstractCompiler
¤
Bases: ABC
Source code in cirkit/backend/base.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
_compiled_circuits = CompiledCircuitsMap()
instance-attribute
¤
_flags = flags
instance-attribute
¤
_registry = registry
instance-attribute
¤
__init__(registry, **flags)
¤
Source code in cirkit/backend/base.py
131 132 133 134 | |
add_initializer_rule(func)
¤
Source code in cirkit/backend/base.py
157 158 | |
add_layer_rule(func)
¤
Source code in cirkit/backend/base.py
151 152 | |
add_parameter_rule(func)
¤
Source code in cirkit/backend/base.py
154 155 | |
compile(sc)
¤
Source code in cirkit/backend/base.py
173 174 175 176 | |
compile_layer(sl)
abstractmethod
¤
Source code in cirkit/backend/base.py
178 179 180 | |
compile_pipeline(sc)
abstractmethod
¤
Source code in cirkit/backend/base.py
182 183 184 | |
get_compiled_circuit(sc)
¤
Source code in cirkit/backend/base.py
142 143 | |
get_symbolic_circuit(cc)
¤
Source code in cirkit/backend/base.py
145 146 | |
has_symbolic(cc)
¤
Source code in cirkit/backend/base.py
139 140 | |
is_compiled(sc)
¤
Source code in cirkit/backend/base.py
136 137 | |
load(sym_filepath, tens_filepath)
abstractmethod
staticmethod
¤
Source code in cirkit/backend/base.py
194 195 196 197 198 199 | |
register_compiled_circuit(sc, cc)
¤
Source code in cirkit/backend/base.py
148 149 | |
retrieve_initializer_rule(signature)
¤
Source code in cirkit/backend/base.py
168 169 170 171 | |
retrieve_layer_rule(signature)
¤
Source code in cirkit/backend/base.py
160 161 | |
retrieve_parameter_rule(signature)
¤
Source code in cirkit/backend/base.py
163 164 165 166 | |
save(sym_filepath, compiled_filepath)
abstractmethod
¤
Source code in cirkit/backend/base.py
186 187 188 189 190 191 192 | |
CompilationRuleNotFound
¤
CompiledCircuitsMap
¤
Source code in cirkit/backend/base.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
_bimap = BiMap[Circuit, CompiledCircuit]()
instance-attribute
¤
__init__()
¤
Source code in cirkit/backend/base.py
42 43 | |
get_compiled_circuit(sc)
¤
Source code in cirkit/backend/base.py
51 52 | |
get_symbolic_circuit(cc)
¤
Source code in cirkit/backend/base.py
54 55 | |
has_symbolic(cc)
¤
Source code in cirkit/backend/base.py
48 49 | |
is_compiled(sc)
¤
Source code in cirkit/backend/base.py
45 46 | |
register_compiled_circuit(sc, cc)
¤
Source code in cirkit/backend/base.py
57 58 | |
CompilerRegistry
¤
Source code in cirkit/backend/base.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
_initializer_rules = {} if initializer_rules is None else initializer_rules
instance-attribute
¤
_layer_rules = {} if layer_rules is None else layer_rules
instance-attribute
¤
_parameter_rules = {} if parameter_rules is None else parameter_rules
instance-attribute
¤
__init__(layer_rules=None, parameter_rules=None, initializer_rules=None)
¤
Source code in cirkit/backend/base.py
62 63 64 65 66 67 68 69 70 71 | |
_validate_rule_sign(func, sym_cls)
staticmethod
¤
Source code in cirkit/backend/base.py
73 74 75 76 77 78 79 80 81 82 83 84 | |
add_initializer_rule(func)
¤
Source code in cirkit/backend/base.py
98 99 100 101 102 | |
add_layer_rule(func)
¤
Source code in cirkit/backend/base.py
86 87 88 89 90 | |
add_parameter_rule(func)
¤
Source code in cirkit/backend/base.py
92 93 94 95 96 | |
retrieve_initializer_rule(signature)
¤
Source code in cirkit/backend/base.py
120 121 122 123 124 125 126 127 | |
retrieve_layer_rule(signature)
¤
Source code in cirkit/backend/base.py
104 105 106 107 108 109 | |
retrieve_parameter_rule(signature)
¤
Source code in cirkit/backend/base.py
111 112 113 114 115 116 117 118 | |
InitializerCompilationFunc
¤
Bases: Protocol
Source code in cirkit/backend/base.py
28 29 30 | |
__call__(compiler, init, **kwargs)
¤
Source code in cirkit/backend/base.py
29 30 | |
LayerCompilationFunc
¤
Bases: Protocol
Source code in cirkit/backend/base.py
18 19 20 | |
__call__(compiler, sl, **kwargs)
¤
Source code in cirkit/backend/base.py
19 20 | |
ParameterCompilationFunc
¤
Bases: Protocol
Source code in cirkit/backend/base.py
23 24 25 | |
__call__(compiler, p, **kwargs)
¤
Source code in cirkit/backend/base.py
24 25 | |