Open isurulucky opened 1 week ago
Hi Isuru,
we already have a "positive-clamp" parameterization. You can see it here:
https://github.com/april-tools/cirkit/blob/main/cirkit/templates/circuit_templates/utils.py#L169-L172
However, if you want to also specify min/max values, you would need to change the Parameterization
class as to allow this extra parameters. For instance, we could have an activation_kwargs
dictionary in Parameterization
that takes the extra arguments, and are then passed to the chosen activation initialization.
If you want even more control on the parameterization, then I suggest using the Circuit.from_region_graph
method to specify layer factories and sum weight factories.
https://cirkit-docs.readthedocs.io/en/latest/api/cirkit/symbolic/circuit/?h=from_region_g#cirkit.symbolic.circuit.Circuit.from_region_graph
Hi @loreloc ,
Thank you for the reply and the info.
I will check out the Circuit.from_region_graph
method.
we already have a "positive-clamp" parameterization. You can see it here: https://github.com/april-tools/cirkit/blob/main/cirkit/templates/circuit_templates/utils.py#L169-L172 However, if you want to also specify min/max values, you would need to change the
Parameterization
class as to allow this extra parameters. For instance, we could have anactivation_kwargs
dictionary inParameterization
that takes the extra arguments, and are then passed to the chosen activation initialization.
I actually tried out the same earlier. If you think this is something good to have in addition to capabilities of Circuit.from_region_graph
, I can send a PR.
BR, Isuru
Hi,
Right now, the
Parameterization
class takes the argumentsinitialization
,activation
anddtype
[1]. If there is a requirement to specify upper and/or lower limits to the circuit parameter values, is there a way of doing it? AFAIU, theParameterization
class should carry this additional arguments, or is there a better way?Some symbolic level parameter classes (ex.:
ClampParameter
[2]) already exist for actual clamping, I think we only need to pass the additional information about min/max values from the definition of the symbolic circuit.[1]. https://github.com/april-tools/cirkit/blob/main/cirkit/templates/circuit_templates/utils.py#L35-L44
[2]. https://github.com/april-tools/cirkit/blob/main/cirkit/symbolic/parameters.py#L563
Thanks, Isuru