Skip to content

Conversation

MilesCranmer
Copy link
Contributor

This changes from e.g.,

  sum(loss(ŷ, y) for (ŷ, y) in zip(outputs, targets))

to

  sum(i -> loss(outputs[i], targets[i]), eachindex(outputs, targets))

which improves speeds by ~3.5x. Fixes #172

@MilesCranmer MilesCranmer changed the title Improve aggregation speeds by summing function Improve aggregation speeds by using eachindex instead of iterate Aug 24, 2023
@juliohm juliohm merged commit 0b3e74f into JuliaML:master Aug 24, 2023
@MilesCranmer MilesCranmer deleted the fix-sum-speeds branch August 24, 2023 12:10
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.

Very slow loss aggregation
2 participants