added data/utils.py. was ignored by .gitignore before...

This commit is contained in:
haoshengzou 2018-01-25 10:15:38 +08:00
parent 5910e08672
commit b8568c6af4
2 changed files with 22 additions and 1 deletions

View File

@ -1 +1 @@
.pyc *.pyc

21
tianshou/data/utils.py Normal file
View File

@ -0,0 +1,21 @@
# internal key match
def internal_key_match(key, keys):
"""
internal rule for key matching between placeholders and data
:param key:
:param keys:
:return: a bool and a data key
"""
if key == 'advantage':
if key in keys:
return True, key
elif 'return' in keys:
return True, 'return'
else:
return False, None
else:
if key in keys:
return True, key
else:
return False, None