-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(frontend-python): write examples guide
- Loading branch information
1 parent
867ed6c
commit acf9b3a
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Examples | ||
|
||
This document gives an overview of example structure. | ||
|
||
## Concrete Python | ||
|
||
### How to create an example? | ||
|
||
There are two options to choose from: | ||
|
||
- Option A) | ||
- Create `examples/foo/foo.ipynb` and `examples/foo/foo_utils.py` | ||
- Write a tutorial in the notebook | ||
- Copy the code to utils | ||
- Add tests for the implementation in `tests/execution/test_examples.py` | ||
- Optionally, create `benchmarks/foo.py` and [add benchmarks](benchmarking.md#how-to-add-new-benchmarks). | ||
|
||
- Option B) | ||
- Create `examples/foo/foo.py` | ||
- Write the script | ||
- Example should contain a class called `Foo` | ||
- `Foo` should have the following arguments in its `__init__`: | ||
- configuration: Optional\[fhe.Configuration] = None | ||
- compiled: bool = True | ||
- It should compile the circuit with an appropriate inputset using the given configuration if compiled is true | ||
- It should have any additional common utilities (e.g., encoding/decoding) shared between the tests and the benchmarks | ||
- Then, add tests for the implementation in `tests/execution/test_examples.py` | ||
- Optionally, create `benchmarks/foo.py` and [add benchmarks](benchmarking.md#how-to-add-new-benchmarks). |