Skip to content
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

Make Batch.__eq__ work also for scalar values (0-dimensional arrays) #1182

Closed
dantp-ai opened this issue Aug 1, 2024 · 2 comments · Fixed by #1186
Closed

Make Batch.__eq__ work also for scalar values (0-dimensional arrays) #1182

dantp-ai opened this issue Aug 1, 2024 · 2 comments · Fixed by #1186
Assignees
Labels
Batch and Buffer Improvements in internal data structures, temporary label

Comments

@dantp-ai
Copy link
Contributor

dantp-ai commented Aug 1, 2024

As first noticed here #1086 (comment), DeepDiff which is currently used for batch equality cannot handle 0-dimensional arrays.

My current proposal is to leverage np.atleast_1d and the newest Batch API's Batch.apply_values_transform to convert any 0-dimensional arrays to 1-d while keeping the others as they are (cf. #1086 (comment)).

@MischaPanch
Copy link
Collaborator

Hi @dantp-ai . All the merges of the new utils were delayed, but better late than never :D.

Sounds good, this a good application of the new method. Feel free to open a PR

@MischaPanch
Copy link
Collaborator

And thanks for hanging in there! I want to devote significantly more time to tianshou in the next weeks and months. Ideally, we'd get to better internals, an automated benchmark that reproduces the results in the docs, and generally more inviting docs and readme over the next few weeks

@MischaPanch MischaPanch added the Batch and Buffer Improvements in internal data structures, temporary label label Aug 1, 2024
MischaPanch pushed a commit that referenced this issue Aug 2, 2024
Fixes: #1182

Note: Updated `test_batch.test_slice_distribution()` to use allclose
(See: #1181).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Batch and Buffer Improvements in internal data structures, temporary label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants