From b7bd0ea13e4dcda615bcfd9e7a59723271deddaa Mon Sep 17 00:00:00 2001 From: KetpuntoG <65235481+KetpuntoG@users.noreply.github.com> Date: Tue, 12 Sep 2023 15:25:57 -0400 Subject: [PATCH] Update tutorial_learning2learn.py --- demonstrations/tutorial_learning2learn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demonstrations/tutorial_learning2learn.py b/demonstrations/tutorial_learning2learn.py index 5bb97a1e61..b9e71b9031 100644 --- a/demonstrations/tutorial_learning2learn.py +++ b/demonstrations/tutorial_learning2learn.py @@ -248,7 +248,7 @@ def hamiltonian(params, **kwargs): # Since we use only one layer in QAOA, params have the shape 1 x 2, # in the form [[alpha, gamma]]. -x = tf.Variable([[0.5], [0.5]], dtype=tf.float32) +x = tf.Variable([[0.5], [0.5]], dtype=tf.float64) # Evaluate th QAOA instance just created with some angles. print(cost(x)) @@ -546,7 +546,7 @@ def train_step(graph_cost): # # Parameters are randomly initialized -x = tf.Variable(np.random.rand(2, 1)) +x = tf.Variable(np.random.rand(2, 1), dtype=tf.float64) # We set the optimizer to be a Stochastic Gradient Descent opt = tf.keras.optimizers.SGD(learning_rate=0.01)