added data/utils.py. was ignored by .gitignore before...
This commit is contained in:
parent
5910e08672
commit
b8568c6af4
2
tianshou/data/.gitignore
vendored
2
tianshou/data/.gitignore
vendored
@ -1 +1 @@
|
|||||||
.pyc
|
*.pyc
|
||||||
|
21
tianshou/data/utils.py
Normal file
21
tianshou/data/utils.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user