Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: enable to make templates if no trained player is in action t… #295

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions handyrl/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ def replace_none(a, b):
players = [random.choice(players)]

# template for padding
obs_zeros = map_r(moments[0]['observation'][moments[0]['turn'][0]], lambda o: np.zeros_like(o))
amask_zeros = np.zeros_like(moments[0]['action_mask'][moments[0]['turn'][0]])
def find_nonzero(ms, key):
for m in ms:
for val in m[key].values():
if val is not None:
return val
obs_zeros = map_r(find_nonzero(moments, 'observation'), lambda o: np.zeros_like(o))
amask_zeros = np.zeros_like(find_nonzero(moments, 'action_mask'))

# data that is changed by training configuration
if args['turn_based_training'] and not args['observation']:
Expand Down