Avalon-Benchmark / avalon

A 3D video game environment and benchmark designed from scratch for reinforcement learning research
https://generallyintelligent.com/avalon/
GNU General Public License v3.0
180 stars 16 forks source link

Fix NDArray check when wrapping observations #10

Closed timokau closed 1 year ago

timokau commented 1 year ago

This would previously break the DictObsActionWrapper when using it with an environment that does not natively come with dictionary observations.

Since the type of observation would typically by numpy.ndarray, which is not equal to nptyping.NDArray, the assertion would fail. What we actually want to check here is that observation has an interface that is compatible with nptyping.NDArray though.

mx781 commented 1 year ago

Hey Timo, good catch, this change makes sense, we should be using isinstance over type(x) == ... wherever possible. We're in the process of figuring out how to handle incoming PRs (we have an internal repo that they need to get synced back to), and we'll try to merge this soon - thanks!

timokau commented 1 year ago

Closing since this is already included in e363d6ba923025a60c79b396293a22d52c4d83a7.