Skip to content

perf: Vectorize index clamping in Dataset.expand_index_in_trial#300

Open
SimpingOjou wants to merge 1 commit into
AdaptiveMotorControlLab:mainfrom
SimpingOjou:fix_expand_index_in_trial
Open

perf: Vectorize index clamping in Dataset.expand_index_in_trial#300
SimpingOjou wants to merge 1 commit into
AdaptiveMotorControlLab:mainfrom
SimpingOjou:fix_expand_index_in_trial

Conversation

@SimpingOjou
Copy link
Copy Markdown

This PR addresses the TODOs in expand_index_in_trial regarding potential speed improvements. The previous implementation utilized a Python list comprehension to iterate over index and calculate boundaries, which created a bottleneck during execution.

Changes

  • Removed the list comprehension used for boundary calculation and clamping.
  • Implemented vectorized lookup for batch_trial_ids.
  • Replaced the iterative clamp with a single operation over the entire tensor.

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Jun 4, 2026

Thank you for your contribution. We require contributors to sign our Contributor License Agreement (CLA). We do not have a signed CLA on file for you. In order for us to review and merge your code, please sign our CLA here. After you signed, you can comment on this PR with @cla-bot check to trigger another check.

@SimpingOjou
Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the CLA signed label Jun 4, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Jun 4, 2026

Thanks for tagging me. I looked for a signed form under your signature again, and updated the status on this PR. If the check was successful, no further action is needed. If the check was unsuccessful, please see the instructions in my first comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant