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

fix for VisibleDepritiationWarning due to numpy #838

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FanFeast
Copy link

@FanFeast FanFeast commented Nov 6, 2023

Fixed Deprecation Warning for ndarray Creation from Ragged Nested Sequences

In this update, we've addressed a deprecation warning that was triggered when creating an ndarray from ragged nested sequences (i.e., a list or tuple of lists or tuples with differing lengths or shapes). The code previously allowed the creation of an array without specifying a data type, which is now deprecated behavior and can lead to unexpected results or errors in future versions.

The fix involved specifying the data type explicitly when creating the ndarray by adding dtype=object to the array creation call. This ensures that the intention is clear when ragged nested sequences are used, and it aligns the code with the updated NumPy requirements, maintaining compatibility and avoiding deprecation issues.

The specific line of code updated is in the augmentations.py file where the ndarray is created:

mode = random.choice(self.sample_options)

After the fix, this line ensures that any ndarray created from sequences of differing lengths or shapes is treated as an object array, thus conforming to the latest best practices and maintaining the stability of the codebase.

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.

1 participant