Skip to content

Conversation

tombagby
Copy link

@tombagby tombagby commented May 8, 2025

The current _cast_value will always cast an np.ndarray to a python list. Instead, when the value is an array and the type to cast to is a numpy dtype, use astype and preserve the array.

The default in librosa is sr=22050, which forces resampling, it has to be set explicitly to None to preserve the original sample rate. I doubt this is intentional?

If resampling is desired, the field description should include an explicit target sample rate to enable.
@tombagby tombagby requested a review from a team as a code owner May 8, 2025 17:55
Copy link

github-actions bot commented May 8, 2025

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

[np.array([1, 2, 3]), DataType.FLOAT32, np.array([1.0, 2.0, 3.0])],
],
)
def test_cast_value_ndarray():
Copy link
Contributor

Choose a reason for hiding this comment

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

def test_cast_value_ndarray(conforms_to, value, data_type, expected):
  ...

Copy link
Contributor

@marcenacp marcenacp left a comment

Choose a reason for hiding this comment

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

Thanks!

LGTM if you fix the red tests.

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.

2 participants