Skip to content

Commit 68c7cc5

Browse files
committed
Merge branch 'main' into fix/multi_threshold_exec_layouts
2 parents 81a0744 + 88a679a commit 68c7cc5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3712
-404
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Inference cost for CNV_2W2A.onnx
101101
}
102102
```
103103

104+
You can use the `--cost-breakdown` option to generate a more detailed report that covers per-node (by name) and per-op-type information.
104105
You can read more about the BOPS metric in [this paper](https://www.frontiersin.org/articles/10.3389/frai.2021.676564/full), Section 4.2 Bit Operations.
105106

106107
### Convert between different quantization representations
@@ -114,16 +115,19 @@ Please see the documentation of the `QuantToQCDQ` transformation to learn more a
114115

115116
## Development
116117

117-
Install in editable mode in a venv:
118+
Install in editable mode in a Python virtual environment:
118119

119120
```
120121
git clone https://github.com/fastmachinelearning/qonnx
121122
cd qonnx
122123
virtualenv -p python3.8 venv
123124
source venv/bin/activate
125+
pip install --upgrade pip
124126
pip install -e .[qkeras,testing]
125127
```
126128

129+
### Running tests
130+
127131
Run entire test suite, parallelized across CPU cores:
128132
```
129133
pytest -n auto --verbose
@@ -134,6 +138,22 @@ Run a particular test and fall into pdb if it fails:
134138
pytest --pdb -k "test_extend_partition.py::test_extend_partition[extend_id1-2]"
135139
```
136140

141+
### Linting
142+
143+
If you plan to make pull requests to the qonnx repo, linting will be required.
144+
We use a pre-commit hook to auto-format Python code and check for issues. See https://pre-commit.com/ for installation. Once you have `pre-commit`,
145+
you can install the hooks into your local clone of the qonnx repo:
146+
147+
```
148+
cd qonnx
149+
source venv/bin/activate
150+
pip install pre-commit
151+
pre-commit install
152+
```
153+
154+
Every time you commit some code, the pre-commit hooks will first run, performing various checks and fixes. In some cases pre-commit won’t be able to
155+
fix the issues and you may have to fix it manually, then run git commit once again. The checks are configured in .pre-commit-config.yaml under the repo root.
156+
137157
## Why QONNX?
138158

139159
The QONNX representation has several advantages compared to other alternatives, as summarized in the table below.

docs/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ Install in editable mode in a venv:
6363
pip install -e .[testing, docs, notebooks]
6464

6565

66+
Test suite
67+
++++++++++
68+
6669
Run entire test suite, parallelized across CPU cores:
6770

6871
::

docs/license.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _license:
22

3-
=======
3+
========
44
License
5-
=======
5+
========
66

77
.. include:: ../LICENSE

notebooks/0_how_to_work_with_onnx.ipynb

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"outputs": [],
3737
"source": [
3838
"import onnx\n",
39-
"from qonnx.basic.util import qonnx_make_model\n",
39+
"from qonnx.util.basic import qonnx_make_model\n",
4040
"\n",
4141
"Add1_node = onnx.helper.make_node(\n",
4242
" 'Add',\n",
@@ -68,26 +68,26 @@
6868
" name='Add2',\n",
6969
")\n",
7070
"\n",
71-
"Add3_node = onnx.helper.make_node(\n",
72-
" 'Add',\n",
73-
" inputs=['abs1', 'abs1'],\n",
74-
" outputs=['sum3'],\n",
75-
" name='Add3',\n",
76-
")\n",
77-
"\n",
7871
"Abs_node = onnx.helper.make_node(\n",
7972
" 'Abs',\n",
8073
" inputs=['sum2'],\n",
8174
" outputs=['abs1'],\n",
8275
" name='Abs'\n",
8376
")\n",
8477
"\n",
78+
"Add3_node = onnx.helper.make_node(\n",
79+
" 'Add',\n",
80+
" inputs=['abs1', 'abs1'],\n",
81+
" outputs=['sum3'],\n",
82+
" name='Add3',\n",
83+
")\n",
84+
"\n",
8585
"Round_node = onnx.helper.make_node(\n",
8686
" 'Round',\n",
8787
" inputs=['sum3'],\n",
8888
" outputs=['out1'],\n",
8989
" name='Round',\n",
90-
")\n"
90+
")"
9191
]
9292
},
9393
{
@@ -253,7 +253,7 @@
253253
"metadata": {},
254254
"outputs": [],
255255
"source": [
256-
"in1_values =np.asarray(np.random.uniform(low=-5, high=5, size=(4,4)), dtype=np.float32)\n",
256+
"in1_values = np.asarray(np.random.uniform(low=-5, high=5, size=(4,4)), dtype=np.float32)\n",
257257
"in2_values = np.asarray(np.random.uniform(low=-5, high=5, size=(4,4)), dtype=np.float32)\n",
258258
"in3_values = np.asarray(np.random.uniform(low=-5, high=5, size=(4,4)), dtype=np.float32)"
259259
]
@@ -350,6 +350,7 @@
350350
"metadata": {},
351351
"outputs": [],
352352
"source": [
353+
"import qonnx\n",
353354
"from qonnx.core.modelwrapper import ModelWrapper\n",
354355
"finn_model = ModelWrapper(onnx_model)"
355356
]
@@ -608,7 +609,7 @@
608609
"metadata": {},
609610
"outputs": [],
610611
"source": [
611-
"onnx_model1 = onnx.qonnx_make_model(graph, producer_name=\"simple-model1\")\n",
612+
"onnx_model1 = qonnx.util.basic.qonnx_make_model(graph, producer_name=\"simple-model1\")\n",
612613
"onnx.save(onnx_model1, '/tmp/simple_model1.onnx')"
613614
]
614615
},
@@ -656,7 +657,7 @@
656657
],
657658
"metadata": {
658659
"kernelspec": {
659-
"display_name": "venv",
660+
"display_name": "Python 3 (ipykernel)",
660661
"language": "python",
661662
"name": "python3"
662663
},
@@ -670,7 +671,7 @@
670671
"name": "python",
671672
"nbconvert_exporter": "python",
672673
"pygments_lexer": "ipython3",
673-
"version": "3.8.16"
674+
"version": "3.8.18"
674675
},
675676
"vscode": {
676677
"interpreter": {
@@ -679,5 +680,5 @@
679680
}
680681
},
681682
"nbformat": 4,
682-
"nbformat_minor": 2
683+
"nbformat_minor": 4
683684
}

0 commit comments

Comments
 (0)