We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ccc3f96 commit f269274Copy full SHA for f269274
qlib/rl/utils/finite_env.py
@@ -56,11 +56,10 @@ def fill_invalid(obj: int | float | bool | np.ndarray | dict | list | tuple) ->
56
57
58
def is_invalid(arr: int | float | bool | np.ndarray | dict | list | tuple) -> bool:
59
- if hasattr(arr, "dtype"):
60
- dtype = getattr(arr, "dtype")
61
- if np.issubdtype(dtype, np.floating):
+ if isinstance(arr, np.ndarray):
+ if np.issubdtype(arr.dtype, np.floating):
62
return np.isnan(arr).all()
63
- return (np.iinfo(dtype).max == arr).all()
+ return (np.iinfo(arr.dtype).max == arr).all()
64
if isinstance(arr, dict):
65
return all(is_invalid(o) for o in arr.values())
66
if isinstance(arr, (list, tuple)):
0 commit comments