Skip to content

Commit 7481139

Browse files
authored
add typical use cases to README (#7)
1 parent 0bae345 commit 7481139

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ Installing `pytest-pytorch` is as easy as
1818
$ pip install pytest-pytorch
1919
```
2020

21+
## How do I use it?
22+
23+
With `pytest-pytorch` installed you can select test cases and tests as if the instantiation for different devices was performed by [`@pytest.mark.parametrize`](https://docs.pytest.org/en/stable/example/parametrize.html#different-options-for-test-ids):
24+
25+
| Use case | Command |
26+
|-------------------------------------|------------------------------------------------------|
27+
| Run a test case against all devices | `pytest test_foo.py::TestBar` |
28+
| Run a test case against one device | `pytest test_foo.py::TestBar -k "$DEVICE"` |
29+
| Run a test against all devices | `pytest test_foo.py::TestBar::test_baz` |
30+
| Run a test against one device | `pytest test_foo.py::TestBar::test_baz -k "$DEVICE"` |
31+
2132
## Can I have a little more background?
2233

2334
PyTorch uses its own method for generating tests that is for the most part compatible with [`unittest`](https://docs.python.org/3/library/unittest.html) and pytest. Its custom test generation allows test templates to be written and instantiated for different device types, data types, and operators. Consider the following module `test_foo.py`:

0 commit comments

Comments
 (0)