Lone test should not call torch.set_deterministic
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
in test/test_functional_tensor.py we have
@pytest.mark.parametrize('device', cpu_and_gpu())
def test_equalize(device):
torch.set_deterministic(False)
check_functional_vs_PIL_vs_scripted(
F.equalize,
F_pil.equalize,
F_t.equalize,
{},
device,
dtype=None,
tol=1.0,
agg_method="max",
)
This usage of set_deterministic is an antipattern, as this setting will leak out to all subsequent tests. Can this be deleted? Or barring that, the setting of the value made temporary (e.g., via a context manager?)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in test/test_functional_tensor.py at test_equalize and review the existing torch.set_deterministic call. Done means the test no longer leaks deterministic state to subsequent tests while the existing equalize test continues to pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100