From a9c0e1bd9c96a61ebdd1e9311be3e34e546bce83 Mon Sep 17 00:00:00 2001 From: WLS2002 <64534280+WLS2002@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:07:29 +0800 Subject: [PATCH] fix a bug in EvoX monitor --- src/tensorneat/common/evox_adaptors/tensorneat_monitor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tensorneat/common/evox_adaptors/tensorneat_monitor.py b/src/tensorneat/common/evox_adaptors/tensorneat_monitor.py index c9bc9b3..26c7eda 100644 --- a/src/tensorneat/common/evox_adaptors/tensorneat_monitor.py +++ b/src/tensorneat/common/evox_adaptors/tensorneat_monitor.py @@ -84,7 +84,7 @@ class TensorNEATMonitor(Monitor): if self.is_save: # save best - best_genome = jax.device_get((pop[0][max_idx], pop[1][max_idx])) + best_genome = jax.device_get(self.best_genome) file_name = os.path.join( self.genome_dir, f"{generation}.npz" ) @@ -107,4 +107,4 @@ class TensorNEATMonitor(Monitor): f"\tfitness: valid cnt: {len(valid_fitnesses)}, max: {max_f:.4f}, min: {min_f:.4f}, mean: {mean_f:.4f}, std: {std_f:.4f}\n", ) - self.tensorneat_algorithm.show_details(self.alg_state, self.fitness) \ No newline at end of file + self.tensorneat_algorithm.show_details(self.alg_state, self.fitness)