Skip to content

Commit 86e6a33

Browse files
rename
1 parent 6fad4a7 commit 86e6a33

File tree

1 file changed

+30
-39
lines changed

1 file changed

+30
-39
lines changed

docs/google/pyle_gates.ipynb renamed to docs/google/internal_gates.ipynb

+30-39
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"id": "dVkNQc0WSIwk"
3838
},
3939
"source": [
40-
"# Pyle Gates in Cirq"
40+
"# Google Internal Gates in Cirq"
4141
]
4242
},
4343
{
@@ -48,39 +48,31 @@
4848
"source": [
4949
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
5050
" <td>\n",
51-
" <a target=\"_blank\" href=\"https://quantumai.google/cirq/google/pyle_gates>\"><img src=\"https://quantumai.google/site-assets/images/buttons/quantumai_logo_1x.png\" />View on QuantumAI</a>\n",
51+
" <a target=\"_blank\" href=\"https://quantumai.google/cirq/google/internal_gates>\"><img src=\"https://quantumai.google/site-assets/images/buttons/quantumai_logo_1x.png\" />View on QuantumAI</a>\n",
5252
" </td>\n",
5353
" <td>\n",
54-
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/quantumlib/Cirq/blob/master/docs/google/pyle_gates.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/colab_logo_1x.png\" />Run in Google Colab</a>\n",
54+
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/quantumlib/Cirq/blob/master/docs/google/internal_gates.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/colab_logo_1x.png\" />Run in Google Colab</a>\n",
5555
" </td>\n",
5656
" <td>\n",
57-
" <a target=\"_blank\" href=\"https://github.com/quantumlib/Cirq/blob/master/docs/google/pyle_gates.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/github_logo_1x.png\" />View source on GitHub</a>\n",
57+
" <a target=\"_blank\" href=\"https://github.com/quantumlib/Cirq/blob/master/docs/google/internal_gates.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/github_logo_1x.png\" />View source on GitHub</a>\n",
5858
" </td>\n",
5959
" <td>\n",
60-
" <a href=\"https://storage.googleapis.com/tensorflow_docs/Cirq/docs/google/pyle_gates.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/download_icon_1x.png\" />Download notebook</a>\n",
60+
" <a href=\"https://storage.googleapis.com/tensorflow_docs/Cirq/docs/google/internal_gates.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/download_icon_1x.png\" />Download notebook</a>\n",
6161
" </td>\n",
6262
"</table>"
6363
]
6464
},
6565
{
6666
"cell_type": "code",
67-
"execution_count": 1,
67+
"execution_count": 5,
6868
"metadata": {
6969
"id": "bd9529db1c0b"
7070
},
71-
"outputs": [
72-
{
73-
"name": "stdout",
74-
"output_type": "stream",
75-
"text": [
76-
"installing cirq...\n",
77-
"installed cirq.\n"
78-
]
79-
}
80-
],
71+
"outputs": [],
8172
"source": [
8273
"try:\n",
8374
" import cirq\n",
75+
" import cirq_google\n",
8476
"except ImportError:\n",
8577
" print(\"installing cirq...\")\n",
8678
" !pip install --quiet cirq\n",
@@ -93,70 +85,70 @@
9385
"cell_type": "markdown",
9486
"metadata": {},
9587
"source": [
96-
"Pyle has a wealth of gates that don't exist or have equivalents in Cirq. `cirq_google.InternalGate` allows the creation of Cirq circuits that contain place holder operations that will get translated to the correct Pyle gate during the Cirq $\n",
97-
"rightarrow$ Pyle conversion."
88+
"Google has a wealth of gates implemented internally that don't exist or have equivalents in Cirq. `cirq_google.InternalGate` allows the creation of Cirq circuits that contain place holder operations that will get translated to the correct internal gate."
9889
]
9990
},
10091
{
10192
"cell_type": "markdown",
10293
"metadata": {},
10394
"source": [
104-
"## InternalGate to PyleGate\n",
105-
"Instances of [cirq_google.InternalGate](https://github.com/quantumlib/Cirq/blob/61d967112ba23cc839b0e922bd42878024a3e738/cirq-google/cirq_google/ops/internal_gate.py#L20) act as placeholder objects for pyle gates. During translation, the correct pyle gate is identified through the `gate_module` and `gate_name` properties. Then an instance of that gate is created using the `kwargs` arguments passed to the `InternalGate` constructor.\n",
106-
"\n",
107-
"**Note:** Currently translation is supported into subclasses of `PyleGate` only. "
95+
"## InternalGate\n",
96+
"Instances of [cirq_google.InternalGate](https://github.com/quantumlib/Cirq/blob/61d967112ba23cc839b0e922bd42878024a3e738/cirq-google/cirq_google/ops/internal_gate.py#L20) act as placeholder objects for google internal gates. During translation, the correct gate is identified through the `gate_module` and `gate_name` properties. Then an instance of that gate is created using the `kwargs` arguments passed to the `InternalGate` constructor."
10897
]
10998
},
11099
{
111100
"cell_type": "code",
112-
"execution_count": 2,
101+
"execution_count": 6,
113102
"metadata": {},
114103
"outputs": [
115104
{
116105
"data": {
117106
"text/plain": [
118-
"cirq_google.InternalGate(gate_name=\"CouplerDelayZ\", gate_module=\"pyle.cirqtools.pyle_gates\", num_qubits=2, delay=4.0, zpa=0, zpl=0)"
107+
"cirq_google.InternalGate(gate_name=\"GATE_NAMPE\", gate_module=\"GATE_MODULE\", num_qubits=2, )"
119108
]
120109
},
121-
"execution_count": 2,
110+
"execution_count": 6,
122111
"metadata": {},
123112
"output_type": "execute_result"
124113
}
125114
],
126115
"source": [
127-
"coupler = cirq_google.InternalGate(\n",
128-
" gate_module='pyle.cirqtools.pyle_gates', # Module of class. \n",
129-
" gate_name='CouplerDelayZ', # Class name.\n",
116+
"internal_gate_args = {\n",
117+
" # Arguments to be passed to the constructor of the internal gate.\n",
118+
"}\n",
119+
"internal_gate = cirq_google.InternalGate(\n",
120+
" gate_module='GATE_MODULE', # Module of class. \n",
121+
" gate_name='GATE_NAMPE', # Class name.\n",
130122
" num_qubits=2, # Number of qubits that the gate acts on.\n",
131-
" delay=4.0, zpa=0, zpl=0) # Arguments to pass to the constructor of pyle.cirqtools.pyle_gates.CouplerDelayZ\n",
132-
"coupler"
123+
" **internal_gate_args)\n",
124+
"internal_gate"
133125
]
134126
},
135127
{
136128
"cell_type": "code",
137-
"execution_count": 3,
129+
"execution_count": 7,
138130
"metadata": {},
139131
"outputs": [
140132
{
141133
"data": {
142134
"text/html": [
143-
"<pre style=\"overflow: auto; white-space: pre;\">0: ───pyle.cirqtools.pyle_gates.CouplerDelayZ(delay=4.0, zpa=0, zpl=0)───\n",
135+
"<pre style=\"overflow: auto; white-space: pre;\">0: ───GATE_MODULE.GATE_NAMPE()───\n",
144136
"\n",
145-
"1: ───#2─────────────────────────────────────────────────────────────────</pre>"
137+
"1: ───#2─────────────────────────</pre>"
146138
],
147139
"text/plain": [
148-
"0: ───pyle.cirqtools.pyle_gates.CouplerDelayZ(delay=4.0, zpa=0, zpl=0)───\n",
140+
"0: ───GATE_MODULE.GATE_NAMPE()───\n",
149141
"\n",
150-
"1: ───#2─────────────────────────────────────────────────────────────────"
142+
"1: ───#2─────────────────────────"
151143
]
152144
},
153-
"execution_count": 3,
145+
"execution_count": 7,
154146
"metadata": {},
155147
"output_type": "execute_result"
156148
}
157149
],
158150
"source": [
159-
"cirq.Circuit(coupler(*cirq.LineQubit.range(2)))"
151+
"cirq.Circuit(internal_gate(*cirq.LineQubit.range(2)))"
160152
]
161153
},
162154
{
@@ -166,8 +158,7 @@
166158
"## Notes\n",
167159
"1. InternalGate is serializable.\n",
168160
"1. Values of `kwargs` must be serializable as [api.v2.ArgValue](https://github.com/quantumlib/Cirq/blob/61d967112ba23cc839b0e922bd42878024a3e738/cirq-google/cirq_google/api/v2/program.proto#L281)\n",
169-
"1. If a value is not serializable as `api.v2.ArgValue` (e.g. a value with unit) then the translator will need to updated to know what to do for that gate. \n",
170-
" For example for the delay `delay` parameter of `CouplerDelayZ`, the translator will expect a float which it will convert into nanoseconds (i.e. the coupler created above has `delay=4ns`). "
161+
"1. If a value is not serializable as `api.v2.ArgValue` (e.g. a value with unit) then the translator will need to updated to know what to do for that gate."
171162
]
172163
}
173164
],

0 commit comments

Comments
 (0)