Depth Control Callback#
Depth Scheduling Callback#
Adaptive control of circuit or model depth across epochs or iterations.
This callback linearly interpolates an integer-valued depth attribute from a starting value to an ending value over a given number of epochs. It updates either a backend or a model object, depending on which one is provided in the callback context.
- class qmlhc.callbacks.depth_control.DepthScheduler(target_attr='depth', start=1, end=6, epochs=10)[source]#
Bases:
CallbackGradually adjust a depth-like attribute during training.
The scheduler linearly interpolates the target attribute (default:
"depth") fromstarttoendoverepochssteps. At the beginning of each epoch, it writes the new integer depth into the object passed via the callback context (context["model"]orcontext["backend"]).- Parameters:
target_attr (str, optional) – Name of the attribute to update, by default
"depth".start (int, optional) – Starting depth value, by default
1.end (int, optional) – Final depth value reached at or before the last epoch, by default
6.epochs (int, optional) – Number of epochs over which to interpolate (minimum 1), by default
10.