Skip to main content
IBM Quantum Platform

가짜 공급자

qiskit.providers.fake_provider


개요

키스킷의 가짜 공급자 모듈에는 트랜스파일러 및 기타 백엔드 대상 기능을 테스트하는 데 유용한 가짜(시뮬레이션된) 백엔드 클래스가 포함되어 있습니다.

사용법 예

다음은 번역 및 실행을 위해 시뮬레이션된 백엔드를 사용하는 예제입니다.

from qiskit import QuantumCircuit, transpile
from qiskit.providers.fake_provider import GenericBackendV2
from qiskit.visualization import plot_histogram

# Generate a 5-qubit simulated backend
backend = GenericBackendV2(num_qubits=5)

# Create a simple circuit
circuit = QuantumCircuit(3)
circuit.h(0)
circuit.cx(0,1)
circuit.cx(0,2)
circuit.measure_all()
circuit.draw('mpl')

# Transpile the ideal circuit to a circuit that can be directly executed by the backend
transpiled_circuit = transpile(circuit, backend)
transpiled_circuit.draw('mpl')

# Run the transpiled circuit using the simulated backend
job = backend.run(transpiled_circuit)
counts = job.result().get_counts()
plot_histogram(counts)
이전 코드의 출력입니다. 이전 코드의 출력입니다. 이전 코드의 출력입니다.

V2 시뮬레이션된 백엔드

GenericBackendV2(qubit 수[, 기본 게이트,...] )구성 가능한 생성자를 가진 일반 BackendV2 구현체.
이 페이지가 도움이 되었습니까?
GitHub에서 버그, 오타를 보고하거나 컨텐츠를 요청하십시오.