Optimize parameter resolution by avoiding redundant calls to _resolve_parameters_
if _is_parameterized_
is False
#6001
Labels
area/parameters
parameter resolution, parameterized gates, operations
area/performance
kind/task
for tracking progress on larger efforts
no QC knowledge needed
Want to contribute to Cirq, but don't know quantum computing? This issue is for you.
triage/accepted
there is consensus amongst maintainers that this is a real bug or a reasonable feature to add
Summarize the task
cirq.resolve_parameters
protocol delegates to the_resolve_parameters_
method of the value for which we need to resolve parameters of. However, this should happen only if thevalue
is parameterized in the first place, to avoid doing redundant work trying to resolve parameters (by creating unnecessary copies for example ).Acceptance criteria - when is the task considered done?
As part of making parameter resolution more performant, we should:
value._resolve_parameters_()
only ifvalue._is_parameterized_()
returns True._is_parameterized_
forFrozenCircuit
andMoment
because they are immutable objects.The text was updated successfully, but these errors were encountered: