From c96f782225b665fdd40dc01c30d75ad352517e89 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 19 Jun 2025 08:57:50 +0200 Subject: [PATCH] Fix: replace deprecated tostring() method with tobytes() numpy.ndarray.tostring() was deprecated and more recently fully removed from numpy. tobytes() should have the exact same behavior. --- rlcard/agents/cfr_agent.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rlcard/agents/cfr_agent.py b/rlcard/agents/cfr_agent.py index 406b0c12d..995b9763a 100644 --- a/rlcard/agents/cfr_agent.py +++ b/rlcard/agents/cfr_agent.py @@ -153,7 +153,7 @@ def eval_step(self, state): action (int): Predicted action info (dict): A dictionary containing information ''' - probs = self.action_probs(state['obs'].tostring(), list(state['legal_actions'].keys()), self.average_policy) + probs = self.action_probs(state['obs'].tobytes(), list(state['legal_actions'].keys()), self.average_policy) action = np.random.choice(len(probs), p=probs) info = {} @@ -173,7 +173,7 @@ def get_state(self, player_id): legal_actions (list): Indices of legal actions ''' state = self.env.get_state(player_id) - return state['obs'].tostring(), list(state['legal_actions'].keys()) + return state['obs'].tobytes(), list(state['legal_actions'].keys()) def save(self): ''' Save model @@ -218,4 +218,3 @@ def load(self): iteration_file = open(os.path.join(self.model_path, 'iteration.pkl'),'rb') self.iteration = pickle.load(iteration_file) iteration_file.close() -