diff --git a/tianshou/data/.gitignore b/tianshou/data/.gitignore index 15584ca..0d20b64 100644 --- a/tianshou/data/.gitignore +++ b/tianshou/data/.gitignore @@ -1 +1 @@ -.pyc +*.pyc diff --git a/tianshou/data/utils.py b/tianshou/data/utils.py new file mode 100644 index 0000000..d073aeb --- /dev/null +++ b/tianshou/data/utils.py @@ -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 \ No newline at end of file