Skip to content

Conversation

@opz
Copy link
Contributor

@opz opz commented May 25, 2025

Fixes #454

When calling fit with a reward scaler on a dataset with varied episode lengths, the following error would be thrown in the fit_with_trajectory_slicer method:

ValueError: setting an array element with a sequence. The requested array has an
inhomogeneous shape after 1 dimensions.

This commit fixes the issue by flattening the rewards before calculating the mean and std.

When calling `fit` with a reward scaler on a dataset with varied episode lengths,
the following error would be thrown in the `fit_with_trajectory_slicer` method:

```
ValueError: setting an array element with a sequence. The requested array has an
inhomogeneous shape after 1 dimensions.
```

This commit fixes the issue by flattening the rewards before calculating the mean and std.
Copy link
Owner

@takuseno takuseno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for your contribution!

@takuseno takuseno merged commit 4f0956b into takuseno:master May 25, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Reward scaler throws an error when using a dataset with varied episode lengths

2 participants