Programming a quantum computer with Cirq (QuantumCasts)
Key Takeaways
This video demonstrates programming a quantum computer using Cirq, a Python framework, and discusses challenges facing quantum programmers, including the capabilities of Noisy Intermediate-Scale Quantum (NISQ) processors.
Full Transcript
a quantum computer is a new type of computer that stores an axon information in its quantum form today we are entering into an exciting era where quantum computers are beginning to be large enough and performant enough to execute tasks in less than a second that would take years to execute on a normal computer here is google's own Bristlecone chip this is a quantum computer made of superconducting circuits with 72 quantum bits google's researchers are using this chip to attempt to achieve a task that cannot be solved in years on a supercomputer hi I'm Dave bacon from Google I run the team that builds software for Google's kuan computers and today I'd like to tell you a little bit about how we program Google's quantum computers we do this using an open source framework called circ a quantum computer stores its information using quantum bits or qubits the information in these qubits is then maneuvered around using the laws of quantum physics describe an algorithm on a quantum computer you use what is called the quantum circuit model the quantum circuit model is essentially a diagram describing how to perform a quantum computation here is an example of a quantum circuit you read this diagram like a sheet of music from left to right each of the qubits in a quantum computer corresponds to a single horizontal wire in the quantum circuit here we see this quantum circuit operates on four cubits the boxes in the diagram correspond to quantum gates that are applied to one or more qubits depending on how many wires the box is connected to here's a single qubit gate and here is a two qubit game quantum gates are instructions to send control signals to the quantum computer to perform a certain quantum action on the qubits finally one has instructions for reading out the quantum information this corresponds to quantum gates that perform measurements and turn quantum bits into classical bit if we have a quantum circuit diagram we can use this diagram to send microwave pulses and instructions to our quantum computing hardware to execute the quantum gates and then read out the result of the circuit like reading a sheet of music as we sweep from left to right we play the given gates as they appear the quantum circuit diagram is cool-looking but of course if we had to draw a diagram to do this and we are writing really long quantum programs this would quickly become very challenging to do to solve this problem researchers developed frameworks or programming languages to write more traditional looking programs that represent the quantum circuit an open source framework that we use that Google for this effort is called Cirque welcome to the surface let's write a simple circuit Cirque is a Python framework this means you can use all the goodness of Python in helping to write your quantum program the central object in Cirque is a circuit object here we show creating a circuit object another key set of objects are qubits let's define two qubits with simple names now we can perform some quantum gates on these qubits let's apply a single qubit Hadamard gate denoted by h2 one of the qubits followed by a two qubit controlled-not or c not gate between the qubits finally let's measure the quantum bits what circuit have we produced simply use print to see the circuit no it's not 1993 but ASCII diagrams are useful for seeing the quantum circuit that you've built here we see the H gate for a Hadamard followed by the controlled night date with the ampersand symbol and the X symbol and finally the measurements represented by M once we've constructed a quantum circuit what do we do with it insert right now you can perform a simulation of the circuit here we run the circuit ten times and see the measurement results measurement results in quantum computers don't always give the same values of bits one run of the circuit may result in the output being zero and another and it being one here we see that the measurement results differ for each run of the simulation circ also contains an interface for running the quantum circuit against actual quantum hardware now that you've seen a simple quantum circuit in circ you might think great now I can write really large quantum programs for example it is known that quantum computers can efficiently factor numbers something that breaks modern public key cryptography that's pretty scary today's quantum computers however are very far from being able to perform this task this is because essentially quantum computers could only perform so much quantum computation before the quantum computation falls apart consider again a quantum circuit every date that you apply in this circuit corresponds to some pretty complicated electronics shaping and setting of electromagnetic fields to the quantum computer these pulses are not always perfect and so every single one of the gates you perform has some effective chance of failing boom one of our single qubit gates has failed in addition to not being able to execute gates exactly quantum computers also have a problem just doing nothing that is if you leave quantum bits around over time the quantum information stored in them will decay away we call this process decoherence boom while waiting to execute the next gate one of our qubits has failed due to the coherence today's quantum computers don't perform exactly as we specify them in the quantum circuit model we call this the problem of noise and quantum computers because of noise the size of our quantum computation is limited for today's quantum computers it is limited both in the number of qubits and the number of operations we can perform on these qubits if quantum computers are noisy can we ever build a really large quantum computer the answer to this is yes using a magic protocol called quantum air correction we won't focus on air correction here but it is a procedure for turning a bunch of noisy qubits into a fewer number of much less noisy cubits since today's quantum computers cannot perform arbitrary large or long quantum computation an important question is what can they do this is the main question of what people call the nist era this stands for noisy intermediate scale quantum and it is used to distinguish today's quantum computers from future err corrected quantum computers are their algorithms a practical value in the nist era we do not know the answer to this question on the other hand we also know that we are starting to build quantum computers which exceed the capabilities of classical computers the so called supremacy frontier because of this there's tremendous excitement in quantum computing we are entering into the unknown an era where there is potential for important discovery we built circ for NIST computers and to aid in this discovery because Sirk is focused on nist computers and not on quantum air corrector computers we made some choices that we believe are important for these near-term devices as an example one choice we made is that we believe that the programmer who is coding Furness calgary limbs needs to be very aware of the idiosyncrasies of the Hardware upon which the quantum computation is run hardware is not abstracted away insert insert this is captured by device objects here is the device object for our Bristlecone device printed out gives a representation of the layout of the qubits on the device we see that it is a strange grid of qubits the qubits are represented by pluses the lines between the qubits represents the fact that only adjacent qubits can be subjected to a two qubit game for example we can perform a two qubit eight between these qubits but not these which are too far apart to directly interact another subtlety of the Bissel cone device is that there are important constraints on when you can simultaneously perform two qubit gates if you apply a two qubit gate to two adjacent qubits then you cannot simultaneously apply a two qubit gate to any of the adjacent qubits of this two qubit gate because the hardware isn't abstracted away in circ we can use the device objects directly when building our quantum program to enforce these constraints for example here we try to perform to two qubit Z gates at the same time on adjacent qubits but because we had passed in the device object to the circuit it is aware of the Bristlecone constraint and when we print out the circuit we see that the circuit has correctly moved one of the CZs to a later time slice in order to avoid violating the constraint Cirque is an open source project licensed under the Apache 2 license if you want to install the latest release of Cirque you can simply run pip install circ in most properly configured environments for running Python circ is an alpha release that is it is under constant and active change we welcome contributions to do this you can go to Turks github repo and follow the instructions for contributing the github repo it also contains links to further documentation for Cirque I'm excited by the next few years of quantum computers are there Ness algorithms that can perform problems of practical importance circ is a tool we are using to help explore this exciting question we hope that you've enjoyed this brief introduction to programming a NIST computer for a more information about Google's efforts in quantum computing I encourage you to check out Google's quantum page [Music]
Original Description
Want to learn how to program a quantum computer using Cirq? In this episode of QuantumCasts, Dave Bacon (Twitter: @dabacon) teaches you what a quantum program looks like via a simple “hello qubit” program. You’ll also learn about some of the exciting challenges facing quantum programmers today, such as whether Noisy Intermediate-Scale Quantum (NISQ) processors have the ability to solve important practical problems. We’ll also delve a little into how the open source Python framework Cirq was designed to help answer that question.
Follow these instructions to install Cirq → http://bit.ly/2IermSw
Need to catch up? Watch every episode of QuantumCasts here → http://bit.ly/2Pw0xay
Learn about the Google AI Quantum team → http://bit.ly/2DnvKLy
Subscribe to the TensorFlow channel→ http://bit.ly/TensorFlow1
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from TensorFlow · TensorFlow · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
The TensorFlow YouTube Channel is Here!
TensorFlow
Answering Your TF Questions #AskTensorFlow
TensorFlow
Chatting With the TensorFlow Community (TensorFlow Meets)
TensorFlow
All About TensorFlow Code (Coding TensorFlow)
TensorFlow
TensorFlow: an ML platform for solving impactful and challenging problems
TensorFlow
Keynote (TensorFlow Dev Summit 2018)
TensorFlow
tf.data: Fast, flexible, and easy-to-use input pipelines (TensorFlow Dev Summit 2018)
TensorFlow
Eager Execution (TensorFlow Dev Summit 2018)
TensorFlow
Machine Learning in JavaScript (TensorFlow Dev Summit 2018)
TensorFlow
Training Performance: A user’s guide to converge faster (TensorFlow Dev Summit 2018)
TensorFlow
The Practitioner's Guide with TF High Level APIs (TensorFlow Dev Summit 2018)
TensorFlow
Distributed TensorFlow (TensorFlow Dev Summit 2018)
TensorFlow
Debugging TensorFlow with TensorBoard plugins (TensorFlow Dev Summit 2018)
TensorFlow
TensorFlow Lite (TensorFlow Dev Summit 2018)
TensorFlow
Searching Over Ideas (TensorFlow Dev Summit 2018)
TensorFlow
Reconstructing Fusion Plasmas (TensorFlow Dev Summit 2018)
TensorFlow
Nucleus: TensorFlow toolkit for Genomics (TensorFlow Dev Summit 2018)
TensorFlow
Open Source Collaboration (TensorFlow Dev Summit 2018)
TensorFlow
Swift for TensorFlow - TFiwS (TensorFlow Dev Summit 2018)
TensorFlow
TensorFlow Hub (TensorFlow Dev Summit 2018)
TensorFlow
Applied AI at The Coca-Cola Company (TensorFlow Dev Summit 2018)
TensorFlow
Real-World Robot Learning (TensorFlow Dev Summit 2018)
TensorFlow
TensorFlow Extended (TFX) (TensorFlow Dev Summit 2018)
TensorFlow
Project Magenta (TensorFlow Dev Summit 2018)
TensorFlow
TensorFlow Dev Summit 2018 - Livestream
TensorFlow
Introducing TensorFlow Lite (Coding TensorFlow)
TensorFlow
TensorFlow Dev Summit 2018 Highlights
TensorFlow
Jeff Dean, Head of AI at Google discusses the impact of ML (TensorFlow Meets)
TensorFlow
TensorFlow Mobile vs. TF Lite and More! #AskTensorFlow
TensorFlow
Using TensorFlow to enable research & production across many fields (TensorFlow Meets)
TensorFlow
Teaching TensorFlow for Deep Learning at Stanford University (TensorFlow Meets)
TensorFlow
TensorFlow Lite for Android (Coding TensorFlow)
TensorFlow
Using the tf.data API to build input pipelines (TensorFlow Meets)
TensorFlow
Training Models in the Cloud & the Benefits of AI Toolkits #AskTensorFlow
TensorFlow
Execute operations immediately with TensorFlow's Eager Execution (TensorFlow Meets)
TensorFlow
TensorFlow Lite for iOS (Coding TensorFlow)
TensorFlow
Get started with TensorFlow's High-Level APIs (Google I/O '18)
TensorFlow
TensorFlow for JavaScript (Google I/O '18)
TensorFlow
TensorFlow in production: TF Extended, TF Hub, and TF Serving (Google I/O '18)
TensorFlow
Get started with TensorFlow's High-Level APIs in 5 mins | Google I/O 2018
TensorFlow
TensorFlow and deep reinforcement learning, without a PhD (Google I/O '18)
TensorFlow
TensorFlow Lite for mobile developers (Google I/O '18)
TensorFlow
Advances in machine learning and TensorFlow (Google I/O '18)
TensorFlow
Distributed TensorFlow training (Google I/O '18)
TensorFlow
Classification using neural networks & ML regression models #AskTensorFlow
TensorFlow
TensorFlow and Keras in R - Josh Gordon meets with J.J. Allaire (TensorFlow Meets)
TensorFlow
Focus on your experiment with TensorFlow Estimators (TensorFlow Meets)
TensorFlow
How to get started with AI/ML, retraining models, & more! #AskTensorFlow
TensorFlow
TensorFlow - the deep learning solution for mobile platforms (TensorFlow Meets)
TensorFlow
MiniGo: TensorFlow Meets Andrew Jackson (TensorFlow Meets)
TensorFlow
The growth of TensorFlow with added support for JS & Swift (TensorFlow Meets)
TensorFlow
At the intersection of TensorFlow & nuclear physics (TensorFlow Meets)
TensorFlow
NVidia TensorRT: high-performance deep learning inference accelerator (TensorFlow Meets)
TensorFlow
Try TensorFlow.js in your browser (Coding TensorFlow)
TensorFlow
TensorFlow Hub: reusing machine learning modules (TensorFlow Meets)
TensorFlow
How to use TensorFlow in PyCharm (TensorFlow Tip of the Week)
TensorFlow
Training models faster with TensorFlow Hub (TensorFlow Meets)
TensorFlow
Prepare your dataset for machine learning (Coding TensorFlow)
TensorFlow
Using ML to predict insulin use for Type 1 Diabetes (TensorFlow Meets)
TensorFlow
TFX: an end-to-end machine learning platform for TensorFlow (TensorFlow Meets)
TensorFlow
Related AI Lessons
⚡
⚡
⚡
⚡
When AI Asks for More Electricity Than a Country Can Imagine
Medium · AI
You Are Not Behind. The World Is.
Medium · AI
Career choice with the advent of AI - pure Computer Science or learn software with a background of core engineering area
Dev.to AI
The AI Hype Cycle: Calm Before the Next Breakthrough?
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI