From 98501a8a69c66392fa53a42d28713fda2f6d98fc Mon Sep 17 00:00:00 2001 From: James Melville Date: Sat, 18 May 2024 10:57:54 -0700 Subject: [PATCH] umap2: ensure n_sgd_threads matches n_threads --- NEWS.md | 5 +++++ R/umap2.R | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index ef73095..3a02667 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # uwot (development version) +## Bug fixes and minor improvements + +* Setting `num_threads` directly in `umap2` did not result in the sgd threads +being updated to that value when `batch = TRUE`, which it should have been. + # uwot 0.2.2 ## Bug fixes and minor improvements diff --git a/R/umap2.R b/R/umap2.R index 0b9e6a5..899f683 100644 --- a/R/umap2.R +++ b/R/umap2.R @@ -728,9 +728,9 @@ umap2 <- if (is.null(n_threads)) { n_threads <- default_num_threads() - if (batch) { - n_sgd_threads <- n_threads - } + } + if (batch && is.numeric(n_sgd_threads) && n_sgd_threads == 0) { + n_sgd_threads <- n_threads } if (is_sparse_matrix(X)) {