-
-
Notifications
You must be signed in to change notification settings - Fork 866
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
env_checker
to use exact data_equivilance
#953
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like @RedTachyon said, there are cases where floating point makes exact a very difficult standard for projects to require.
I would prefer to reduce the allclose
atol
or rtol
values than change to allequal
As I previously said, the operations in While it is true that for example that:
|
Can't we do like a two-tiered check? If they're not Alternatively, maybe we can just add a switch in |
I agree with @RedTachyon on the two-tier testing |
I'm sorry, I do not understand the benefit of a two-tier testing System. All deterministic environments. Should fail if they cannot pass note: NaN It is already tested before the determinism checks. |
From my perspective, we can take the The second is a comprehensive testing tool that covers everything about the function. In my opinion, we should test the essential core elements of the API comprehensively, while the non-essential elements (i.e., determinism) should be more lacks. Particularly for determinism that is very difficult to guarantee for some environment with external simulators, etc and as Gymnasium is a general API we should try to find a middle ground on this. Therefore, a two-tier equivalence system could help provide a middle ground to purely alert users if strict equivalence doesn't hold but not failure that would prevent the rest of the testing suite to complete. For non-essential items, I don't want the testing to fail and the user disregard the function when later parts of the function would show essential elements actually failing if they continued using it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the warning and error messages be a bit different otherwise it could be difficult for users to understand what is happening
My suggested changes assert data_equivalence(
obs_0, obs_1
), "Deterministic step observations are not equivalent for the same seed and action"
if not data_equivalence(obs_0, obs_1, exact=True):
logger.warn(
"Step observations are not equal although similar given the same seed and action"
)
assert data_equivalence(
rew_0, rew_1
), "Deterministic step rewards are not equivalent for the same seed and action"
if not data_equivalence(rew_0, rew_1, exact=True):
logger.warn(
"Step rewards are not equal although similar given the same seed and action"
)
assert data_equivalence(
term_0, term_0, exact=True
), "Deterministic step termination are not equivalent for the same seed and action"
assert (
trunc_0 is False and trunc_1 is False
), "Environment truncates after 1 step, something has gone very wrong."
assert data_equivalence(
info_0,
info_1,
), "Deterministic step info are not equivalent for the same seed and action"
if not data_equivalence(info_0, info_1, exact=True):
logger.warn(
"Step info are not equal although similar given the same seed and action"
) and if env.spec is not None and env.spec.nondeterministic is False:
assert data_equivalence(
obs_1, obs_2
), "Using `env.reset(seed=123)` is non-deterministic as the observations are not equivalent."
if not data_equivalence(obs_1, obs_2, exact=True):
logger.warn(
"Using `env.reset(seed=123)` observations are not equal although similar."
) |
Description
fixes #927
Type of change
Please delete options that are not relevant.
Screenshots
Please attach before and after screenshots of the change if applicable.
Checklist:
pre-commit
checks withpre-commit run --all-files
(seeCONTRIBUTING.md
instructions to set it up)