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 padding op faster and add error check #147

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jperez999
Copy link
Collaborator

This PR substitutes the loop creating the range of individual indices for each value to be added to the padded array with a map function in order to make it faster. This PR also adds a check to ensure that the padding size selected by user fits the data. If the data has any records that are bigger than the padding size, we raise a value error. This op is for padding only, it does not incorporate list slice.

@jperez999 jperez999 added the enhancement New feature or request label May 11, 2023
@jperez999 jperez999 self-assigned this May 11, 2023
row_ranges.extend(array_lib.arange(int(starts[idx]), int(ends[idx])))
row_ranges = array_lib.concatenate(
list(map(functools.partial(get_arange, array_lib), starts, ends))
)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is very slick 😎

@karlhigley karlhigley added this to the Merlin 23.05 milestone May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants