qml.resource.resources_from_tape¶
- resources_from_tape(tape, compute_depth=True, compute_errors=False)[source]¶
Extracts the resource information from a quantum circuit (tape).
The depth of the circuit is computed by default, but can be set to None by setting the compute_depth argument to False. This is useful when the depth is not needed, for example, in some resource counting scenarios or heavy circuits where computing depth is expensive.
- Parameters:
tape (.QuantumScript) – The quantum circuit for which we extract resources
compute_depth (bool) – If True, the depth of the circuit is computed and included in the resources. If False, the depth is set to None.
compute_errors (bool) – If True, algorithmic errors are computed and returned alongside the resources. Defaults to False.
- Returns:
The resources associated with this tape, optionally with algorithmic errors if compute_errors is set to True.
- Return type:
(SpecsResources | tuple[SpecsResources, dict[str, Any]])