Skip to content

Optimized functions to handle large arrays#64

Open
ajinkya-kulkarni wants to merge 1 commit intoadalca:devfrom
ajinkya-kulkarni:patch-1
Open

Optimized functions to handle large arrays#64
ajinkya-kulkarni wants to merge 1 commit intoadalca:devfrom
ajinkya-kulkarni:patch-1

Conversation

@ajinkya-kulkarni
Copy link

  1. Used a numerically stable implementation to compute the softmax of a numpy array along a given dimension, which reduces the chances of overflows or underflows and improves performance for large arrays.
  2. Used numpy's unique() and cumsum() functions to create the lab_to_ind lookup table, which is more efficient than looping over each label, especially for large arrays.
  3. Used numpy's in1d() function to create a boolean mask of the unique labels, and then used numpy's broadcasting to assign the corresponding RGB values to the output array, which is more efficient than looping over each label, especially for large arrays.

1. Used a numerically stable implementation to compute the softmax of a numpy array along a given dimension, which reduces the chances of overflows or underflows and improves performance for large arrays.
2. Used numpy's unique() and cumsum() functions to create the lab_to_ind lookup table, which is more efficient than looping over each label, especially for large arrays.
3. Used numpy's in1d() function to create a boolean mask of the unique labels, and then used numpy's broadcasting to assign the corresponding RGB values to the output array, which is more efficient than looping over each label, especially for large arrays.
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