File tree 3 files changed +80
-10
lines changed
3 files changed +80
-10
lines changed Original file line number Diff line number Diff line change
1
+
2
+ .. Places parent toc into the sidebar
3
+ :parenttoc: True
4
+
5
+ .. title :: API: contents
6
+
7
+ .. _api_reference :
8
+
9
+ ====================
10
+ API reference
11
+ ====================
12
+
13
+
14
+ .. toctree ::
15
+ :numbered:
16
+ :maxdepth: 2
17
+ :titlesonly:
18
+
19
+
20
+ emlearn_cnn
21
+ ------------
22
+
23
+ .. automodule :: emlearn_cnn
24
+ :members:
Original file line number Diff line number Diff line change 17
17
import sys
18
18
import subprocess
19
19
20
- sys .path .insert (0 , os .path .abspath ('..' ))
20
+ # Adjust path so we can find the .py files with API documentation
21
+ sys .path .insert (0 , os .path .abspath ('../stubs' ))
21
22
22
23
# -- Project information -----------------------------------------------------
23
24
44
45
'sphinx.ext.mathjax' ,
45
46
'sphinx.ext.viewcode' ,
46
47
'sphinx.ext.autodoc' ,
48
+ 'sphinx_autodoc_typehints' ,
47
49
'sphinx.ext.doctest' ,
48
50
'sphinx.ext.coverage' ,
49
51
'sphinx.ext.autosectionlabel' ,
200
202
201
203
# -- Extension configuration -------------------------------------------------
202
204
203
-
204
- sphinx_gallery_conf = {
205
- 'examples_dirs' : '../examples' , # path to your example scripts
206
- 'gallery_dirs' : 'auto_examples' , # path to where to save gallery generated output
207
- 'filename_pattern' : '/' , # execute all .py files, not just those with plot_ prefix
208
- }
209
-
210
-
211
-
205
+ # -- Intersphinx
212
206
intersphinx_mapping = {
213
207
"emlearn" : ("https://emlearn.readthedocs.io/en/latest/" , None ),
214
208
}
219
213
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#confval-intersphinx_disabled_reftypes
220
214
intersphinx_disabled_reftypes = ["*" ]
221
215
216
+ # -- autodoc typehints
217
+ always_document_param_types = True
218
+ typehints_fully_qualified = True
219
+ always_use_bars_union = True
220
+
221
+
Original file line number Diff line number Diff line change
1
+ # Stub file (PEP 484) with API definitions and documentation for native module
2
+ # Is called .py because Sphinx autodoc currently does not support .pyi files
3
+
4
+ """
5
+ Convolutional Neural Network module.
6
+
7
+ Implemented using TinyMaix (https://github.com/sipeed/TinyMaix/).
8
+
9
+ Note that multiple variants of this module is provided.
10
+ So the import should either be **emlearn_cnn_fp32** (for 32 bit floating point),
11
+ or **emlearn_cnn_int8** (for 8 bit integers, quantized model).
12
+
13
+ """
14
+
15
+ import array
16
+
17
+ class Model ():
18
+ """A Convolutional Neural Network
19
+
20
+ Note: May not be constructed directly. Instead use the new() function.
21
+ """
22
+ def run (self , inputs : array .array , outputs : array .array ):
23
+ """
24
+ Run inference using the model
25
+
26
+ :param inputs: the input data
27
+ :param outputs: where to put model outputs
28
+ """
29
+ pass
30
+
31
+ def output_dimensions (self ) -> tuple [int ]:
32
+ """
33
+ Get the output dimensions/size of the model
34
+
35
+ Useful to know how large an array to pass to run()
36
+ """
37
+ pass
38
+
39
+ def new (model_data : array .array ) -> Model :
40
+ """
41
+ Construct a new Convolutional Neural Network
42
+
43
+ :param model_data: The model definition (.TMDL file, as bytes).
44
+ """
45
+ pass
46
+
You can’t perform that action at this time.
0 commit comments