Skip to content

Commit 1425631

Browse files
fix GP deprecation with tf-keras
1 parent d207068 commit 1425631

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

notebooks/GP_lorenz96.ipynb

+5-9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"import gpflow\n",
2020
"from L96_model import L96, L96_eq1_xdot, integrate_L96_2t\n",
2121
"from L96_model import EulerFwd, RK2, RK4\n",
22+
"import os\n",
23+
"\n",
24+
"os.environ[\"TF_USE_LEGACY_KERAS\"] = \"True\"\n",
2225
"\n",
2326
"time_method = RK4"
2427
]
@@ -335,7 +338,7 @@
335338
" train_iter = iter(train_dataset.batch(batch_size))\n",
336339
" training_loss = model.training_loss_closure(train_iter, compile=True)\n",
337340
"\n",
338-
" optimizer = tf.optimizers.Adam()\n",
341+
" optimizer = tf.keras.optimizers.legacy.Adam()\n",
339342
"\n",
340343
" @tf.function\n",
341344
" def optimization_step(trainable_variables):\n",
@@ -893,13 +896,6 @@
893896
"plt.legend(frameon=False, fontsize=7)\n",
894897
"plt.show()"
895898
]
896-
},
897-
{
898-
"cell_type": "code",
899-
"execution_count": null,
900-
"metadata": {},
901-
"outputs": [],
902-
"source": []
903899
}
904900
],
905901
"metadata": {
@@ -918,7 +914,7 @@
918914
"name": "python",
919915
"nbconvert_exporter": "python",
920916
"pygments_lexer": "ipython3",
921-
"version": "3.10.12"
917+
"version": "3.9.19"
922918
}
923919
},
924920
"nbformat": 4,

notebooks/figs/Burgers_simulation.gif

-1.07 MB
Loading

notebooks/figs/L96_one_variable.gif

-4.28 KB
Loading

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ pysindy
44
torch-lr-finder
55
gplearn
66
gpflow
7+
tf-keras

0 commit comments

Comments
 (0)