Parametrized Quantum Circuits for Reinforcement Learning stuck if using qsim backend
维护者通常 4 天内回复
@mhucka 已经在做这个了。
开始于 2026年6月5日。
评估
这个 Issue 还没有评估数据。
描述
I've ran this notebook with no problem. However, if I try to use qsim as a backend by passing the backend backend = qsimcirq.QSimSimulator() explicitly to ReUploadingPQC, then I get the following message
2023-04-26 09:20:03.862016: W tensorflow/core/grappler/optimizers/loop_optimizer.cc:907] Skipping loop optimization for Merge node with control input: cond/branch_executed/_12
and it gets stuck there indefinitely.
Any idea of what might be going on?
To reproduce:
replace
def generate_model_policy(
qubits: List[cirq.GridQubit],
n_layers: int,
n_actions: int,
beta: float,
observables: List[cirq.PauliString],
) -> tf.keras.Model:
"""Generates a Keras model for a data re-uploading PQC policy."""
input_tensor = tf.keras.Input(shape=(len(qubits),), dtype=tf.dtypes.float32, name="input")
re_uploading_pqc = ReUploadingPQC(qubits, n_layers, observables)([input_tensor])
process = tf.keras.Sequential(
[Alternating(n_actions), tf.keras.layers.Lambda(lambda x: x * beta), tf.keras.layers.Softmax()],
name="observables-policy",
)
policy = process(re_uploading_pqc)
model = tf.keras.Model(inputs=[input_tensor], outputs=policy)
return model
with
def generate_model_policy(
qubits: List[cirq.GridQubit],
n_layers: int,
n_actions: int,
beta: float,
observables: List[cirq.PauliString],
backend="noiseless",
) -> tf.keras.Model:
"""Generates a Keras model for a data re-uploading PQC policy."""
input_tensor = tf.keras.Input(shape=(len(qubits),), dtype=tf.dtypes.float32, name="input")
re_uploading_pqc = ReUploadingPQC(qubits, n_layers, observables, backend=backend)([input_tensor])
process = tf.keras.Sequential(
[Alternating(n_actions), tf.keras.layers.Lambda(lambda x: x * beta), tf.keras.layers.Softmax()],
name="observables-policy",
)
policy = process(re_uploading_pqc)
model = tf.keras.Model(inputs=[input_tensor], outputs=policy)
return model
and then replace
model = generate_model_policy(qubits, n_layers, n_actions, 1.0, observables)
backend = qsimcirq.QSimSimulator()
model = generate_model_policy(qubits, n_layers, n_actions, 1.0, observables, backend=backend)
versions:
gym = "==0.22.0"
tensorflow = "2.7.0"
tensorflow-quantum = "0.7.2"
qsimcirq = "0.13.3" # <0.16.0 because of incompatibility with tensorflow-quantum
- 主要语言
- Python
- 星标
- 2.2k
- 派生
- 672
- 平均合并
- 2 天 15 小时
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tensorflow/quantum 的其他 Issue
-
Avoid hard-coding "quantum" in `scripts/` scripts可能已有人在做 @openbotgit 于 9 天前认领。 未关闭area/devops help wanted no QC knowledge needed priority/before-0.7.7
难度 2/5 1-3 小时 新手友好度 68/100
tensorflow/quantum#1082 · 2 条评论 · 1 个 reaction ·
维护者通常 4 天内回复
-
Bug (likely typo) in `core/serialize/serializer_test.py`可能已有人在做 @mhucka 于 1 天前认领。 未关闭area/serialization area/tests
tensorflow/quantum#1129 · 已指派 1 人 ·
维护者通常 4 天内回复
-
Support Keras 3可能重新可做 @rosspeili 于 105 天前认领,目前没有进行中的 PR。 未关闭area/keras help wanted skill-level/intermediate
tensorflow/quantum#1090 · 5 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
-
area/circuits priority/after-0.7.7 skill-level/expert
难度 5/5 一周以上 新手友好度 25/100
tensorflow/quantum#1087 ·
维护者通常 4 天内回复
-
Efficiently handle circuit sizes 10x or more of today's circuits可能重新可做 @SripriyaDevarapalli 于 25 天前认领,目前没有进行中的 PR。 未关闭area/circuits area/performance help wanted priority/after-0.7.7 skill-level/expert
难度 5/5 一周以上 新手友好度 25/100
tensorflow/quantum#1086 · 1 条评论 ·
维护者通常 4 天内回复
查看 tensorflow/quantum 的全部 Issue
相似的 Issue
-
app: scripts status: backlog type: documentation
难度 2/5 1-3 小时 新手友好度 86/100
netbox-community/netbox-scripts#68 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 91/100
marin-community/marin#10765 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 70/100
flathub/com.unity.UnityHub#230 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
namespace operations
难度 1/5 1 小时以内 新手友好度 63/100
EclipseFdn/open-vsx.org#14910 ·
维护者通常 1 天内回复