code: def _count_resources(tape) -> Resources:
      """Given a quantum circuit (tape), this function
       counts the resources used by standard PennyLane operations.
  
      Args:
          tape (.QuantumTape): The quantum circuit for which we count resources
  
      Returns:
          (.Resources): The total resources used in the workflow
      """
      num_wires = len(tape.wires)
      shots = tape.shots
      depth = tape.graph.get_depth()
  
      num_gates = 0
      gate_types = defaultdict(int)
      gate_sizes = defaultdict(int)
      for op in tape.operations:
          if isinstance(op, ResourcesOperation):
              op_resource = op.resources()
              for d in op_resource.gate_types:
                  gate_types[d] += op_resource.gate_types[d]
  
              for n in op_resource.gate_sizes:
                  gate_sizes[n] += op_resource.gate_sizes[n]
  
              num_gates += sum(op_resource.gate_types.values())
  
          else:
              gate_types[op.name] += 1
              gate_sizes[len(op.wires)] += 1
              num_gates += 1
  
      return Resources(
          num_wires, num_gates, gate_types, gate_sizes, depth, shots
      )
  
file_path: pennylane/pennylane/resource/resource.py
imports: from abc import abstractmethod
  from collections import defaultdict
  from dataclasses import dataclass, field
  from pennylane.operation import Operation
  from pennylane.measurements import Shots
label_desc: Use image node_id 1 for calling a global function with example usage: _count_resources(tape) and returns: Resources