Skip to content

Commit

Permalink
Update on "opcheck should be usable without optional dependencies"
Browse files Browse the repository at this point in the history
This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
  • Loading branch information
zou3519 committed May 28, 2024
1 parent aec3eaf commit cbf4452
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torch/testing/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def wrapper_set_seed(op, *args, **kwargs):
if isinstance(output, torch.Tensor) and output.device.type == "lazy":
# We need to call mark step inside freeze_rng_state so that numerics
# match eager execution
torch._lazy.mark_step()
torch._lazy.mark_step() # type: ignore[attr-defined]

return output

Expand Down Expand Up @@ -50,5 +50,5 @@ def freeze_rng_state():
# NB: Mode disable is to avoid running cross-ref tests on thes seeding
with no_dispatch(), disable_functorch():
if torch.cuda.is_available():
torch.cuda.set_rng_state(cuda_rng_state)
torch.cuda.set_rng_state(cuda_rng_state) # type: ignore[possibly-undefined]
torch.set_rng_state(rng_state)

0 comments on commit cbf4452

Please sign in to comment.