Skip to content

Commit 28ffd6b

Browse files
authored
Merge pull request #47 from MathEXLab/update_tensorflow
Update TensorFlow/Keras legacy APIs, test Python 3.12
2 parents 58286ad + d4a3053 commit 28ffd6b

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- "3.9"
3333
- "3.10"
3434
- "3.11"
35-
# - "3.12"
35+
- "3.12"
3636

3737
steps:
3838
- name: Configure hostname

pyspod/emulation/neural_nets.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,9 @@
2222

2323
# set seeds
2424
from numpy.random import seed; seed(1)
25-
tf.compat.v1.set_random_seed(2)
26-
27-
# start session
28-
session_conf = tf.compat.v1.ConfigProto(
29-
intra_op_parallelism_threads=1, inter_op_parallelism_threads=1)
30-
session = tf.compat.v1.Session(
31-
graph=tf.compat.v1.get_default_graph(), config=session_conf)
32-
tf.compat.v1.keras.backend.set_session(session)
25+
tf.random.set_seed(2)
26+
tf.config.threading.set_intra_op_parallelism_threads(1)
27+
tf.config.threading.set_inter_op_parallelism_threads(1)
3328

3429

3530

@@ -173,7 +168,7 @@ def model_inference(self, data_in, idx=0):
173168
## compute real part
174169
cnt = 0
175170
name_tmp = 'real'+str(idx)
176-
name_real = os.path.join(self._savedir, name_tmp+'__weights.h5')
171+
name_real = os.path.join(self._savedir, name_tmp+'.weights.h5')
177172
self.model.load_weights(name_real)
178173
for t in tqdm(range(n_seq_in,nt,n_seq_out), desc='inference_real'):
179174
idx_x[cnt,...] = np.arange(t-n_seq_in, t)
@@ -188,7 +183,7 @@ def model_inference(self, data_in, idx=0):
188183
if not np.isreal(data_in).all():
189184
cnt = 0
190185
name_tmp = 'imag'+str(idx)
191-
name_imag = os.path.join(self._savedir, name_tmp+'__weights.h5')
186+
name_imag = os.path.join(self._savedir, name_tmp+'.weights.h5')
192187
self.model.load_weights(name_imag)
193188
for t in tqdm(range(n_seq_in,nt,n_seq_out), desc='inference_imag'):
194189
idx_x[cnt,...] = np.arange(t-n_seq_in, t)
@@ -213,7 +208,7 @@ def _train(self, data_train, data_valid, name):
213208
valid_data_ip, valid_data_op = self.extract_sequences(data=data_valid)
214209

215210
# training
216-
name_filepath = os.path.join(self._savedir, name+'__weights.h5')
211+
name_filepath = os.path.join(self._savedir, name+'.weights.h5')
217212
cb_chk = tf.keras.callbacks.ModelCheckpoint(
218213
name_filepath,
219214
monitor='loss',

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = attr: pyspod.__version__
44
description = Python Spectral Proper Orthogonal Decomposition
55
long_description = file:README.md
66
long_description_content_type = text/markdown
7-
author = Gianmarco Mengaldo, Marcin Rogoswki, Lisandro Dalcin, Romit Maulik, Andrea Lario
7+
author = Gianmarco Mengaldo, Marcin Rogowski, Lisandro Dalcin, Romit Maulik, Andrea Lario
88
99
url = https://github.com/MathEXLab/PySPOD
1010
license = MIT
@@ -16,11 +16,11 @@ classifiers =
1616
Intended Audience :: Science/Research
1717
License :: OSI Approved :: MIT License
1818
Programming Language :: Python :: 3
19-
Programming Language :: Python :: 3.7
2019
Programming Language :: Python :: 3.8
2120
Programming Language :: Python :: 3.9
2221
Programming Language :: Python :: 3.10
2322
Programming Language :: Python :: 3.11
23+
Programming Language :: Python :: 3.12
2424
Topic :: Scientific/Engineering :: Mathematics
2525

2626
[options]

0 commit comments

Comments
 (0)