From aa6d5bcb1837aea3ab9e26902def1d8c07f8e3b9 Mon Sep 17 00:00:00 2001 From: Akhil Gupta Date: Tue, 6 Oct 2026 21:45:47 -0700 Subject: [PATCH 1/2] docs: clarify save vs save_weights for TFQ models --- docs/concepts.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/concepts.md b/docs/concepts.md index d1485a5b6..76c912128 100644 --- a/docs/concepts.md +++ b/docs/concepts.md @@ -35,7 +35,7 @@ and machine learning. system. This can be data generated by a quantum computer, like the samples gathered from the Sycamore processor -for Google’s demonstration of quantum supremacy. Quantum data exhibits +for Google's demonstration of quantum supremacy. Quantum data exhibits superposition and entanglement, leading to joint probability distributions that could require an exponential amount of classical computational resources to represent or store. The quantum supremacy experiment showed it is possible to @@ -85,6 +85,14 @@ A *quantum neural network* (QNN) is used to describe a parameterized quantum computational model that is best executed on a quantum computer. This term is often interchangeable with *parameterized quantum circuit* (PQC). +#### Saving models + +Note: `model.save()` does not work for TensorFlow Quantum models containing +custom quantum layers, because full model serialization requires the layer +to be reconstructable without the original Python code. Instead, use +`model.save_weights()` to save the trained parameters, then rebuild the model +architecture in Python and restore them with `model.load_weights()`. + ## Research @@ -109,9 +117,9 @@ with particular interest in: quality quantum gates. 2. *Model quantum data with quantum circuits.* Classically modeling quantum data is possible if you have an exact description of the datasource—but sometimes - this isn’t possible. To solve this problem, you can try modeling on the + this isn't possible. To solve this problem, you can try modeling on the quantum computer itself and measure/observe the important statistics. - Quantum convolutional neural networks + Quantum convolutional neural networks shows a quantum circuit designed with a structure analogous to a convolutional neural network (CNN) to detect different topological phases of matter. The quantum computer holds the data and the model. The classical From 8ad3486af71c2c7087d2eaa3154bf78e0c2416dd Mon Sep 17 00:00:00 2001 From: Akhil Gupta Date: Tue, 6 Oct 2026 22:20:00 -0700 Subject: [PATCH 2/2] ci: install pydot and graphviz for tutorial plot_model tests --- scripts/ci_validate_tutorials.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/ci_validate_tutorials.sh b/scripts/ci_validate_tutorials.sh index f1294f65b..c858a32ae 100755 --- a/scripts/ci_validate_tutorials.sh +++ b/scripts/ci_validate_tutorials.sh @@ -32,6 +32,9 @@ pip install gymnasium[classic-control]==1.2.3 pip install seaborn==0.12.0 # tf_docs pip package needed for noise tutorial. pip install -q git+https://github.com/tensorflow/docs +# pydot and graphviz needed for tf.keras.utils.plot_model in tutorials +pip install pydot +sudo apt-get install -y graphviz # Leave the quantum directory, otherwise errors may occur cd ..