From d1bddb300eb88a6dea4f8387ea3056d406a25712 Mon Sep 17 00:00:00 2001 From: Luke Marris Date: Thu, 29 Aug 2024 12:03:16 +0000 Subject: [PATCH] Fix pyspiel to python policy function when using deterministic policies. PiperOrigin-RevId: 668891440 Change-Id: Ib2f8528c9f34c4045193e448f253cb9b3b188c8a --- open_spiel/python/policy.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/open_spiel/python/policy.py b/open_spiel/python/policy.py index d235b4bf74..fc0427e5a2 100644 --- a/open_spiel/python/policy.py +++ b/open_spiel/python/policy.py @@ -520,6 +520,8 @@ def pyspiel_policy_to_python_policy(game, pyspiel_tabular_policy, players=None): if players is not None and info_state_str not in policy.state_lookup: continue state_policy = policy.policy_for_key(info_state_str) + if actions_probs: + state_policy[:] = 0.0 # Ensure policy is zero by default. for action, prob in actions_probs: state_policy[action] = prob return policy