Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
sebffischer committed Oct 16, 2024
1 parent 6907072 commit 30c65ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/test_with_torch_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ test_that("with_torch_settings leaves global state untouched", {
}
prev_torch_rng_state = torch_get_rng_state()

with_torch_settings(1, 1, {
with_torch_settings(1, 1, 1, {
y1 = torch_randn(1)
})

with_torch_settings(1, 1, {
with_torch_settings(1, 1, 1, {
y2 = torch_randn(1)
})

Expand All @@ -28,12 +28,12 @@ test_that("with_torch_settings leaves global state untouched", {
# (This would happen if we did not set the seed afterwards back to the previous value)

withr::with_seed(10, {
with_torch_settings(seed = 1, num_threads = 1, NULL)
with_torch_settings(seed = 1, num_threads = 1, num_interop_threads = 1, NULL)
at = torch_randn(1)
})

withr::with_seed(20, {
with_torch_settings(seed = 1, num_threads = 1, NULL)
with_torch_settings(seed = 1, num_threads = 1, num_interop_threads = 1, NULL)
bt = torch_randn(1)
})
expect_false(torch_equal(at, bt))
Expand Down

0 comments on commit 30c65ab

Please sign in to comment.