2222
2323# set seeds
2424from 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' ,
0 commit comments