neural_compressor.template.api_doc_example
This module is only used as reference to convert Python docstring to API document.
The created the API document is in API Doc.
Usage:
$python api_doc_example.py
Example:
def fun(a):
return a+1
x = fun(2)
print(x)
- neural_compressor.template.api_doc_example.attribute1[source]
Module level attribute.
Please set 1-100 integer.
- Type:
int
Attributes
Module debug level document. |
Classes
Example for Class. |
Functions
|
Example function1. |
|
Function with PEP 484 type annotations. |
|
This is an example of function3. |
|
Generators have a |
Module Contents
- neural_compressor.template.api_doc_example.module_debug_level1 = 1[source]
Module debug level document.
- Type:
int
- neural_compressor.template.api_doc_example.function1(param1, param2)[source]
Example function1.
- Parameters:
param1 (str) – The parameter1.
param2 (float) – The parameter2.
Example:
>>> python api_doc_example.py >>> import os ... for i in range(3) ... print(i) 0 1 2
- Returns:
The return value. True|False.
- Return type:
bool
- neural_compressor.template.api_doc_example.function2(param1: str, param2: float) bool [source]
Function with PEP 484 type annotations.
- Parameters:
param1 – The parameter1.
param2 – The parameter2.
Example
Style 3:
from neural_compressor.config import MixedPrecisionConfig def eval_func(model): ... return accuracy conf = MixedPrecisionConfig() output_model = mix_precision.fit( model, conf, eval_func=eval_func, )
- Returns:
The return value. True|False.
- neural_compressor.template.api_doc_example.function3(param1, param2=None, *args, **kwargs)[source]
This is an example of function3.
If
*args
or**kwargs
are accepted, they should be listed as*args
and**kwargs
.- Parameters:
param1 (int) – The parameter1.
param2 (
str
, optional) – The parameter2.*args – Arguments list.
**kwargs – Key-value dict.
- Returns:
The return value. True|False.
The
Returns
section supports any reStructuredText formatting, including literal blocks:{ 'param1': param1, 'param2': param2 }
- Return type:
bool
- Raises:
AttributeError – The
Raises
section is a list of exceptions.ValueError – If param2 is equal to param1.
- neural_compressor.template.api_doc_example.generator1(n)[source]
Generators have a
Yields
section.- Parameters:
n (int) – range.
- Yields:
int – The next number in [0, n - 1].
Examples:
>>> print([i for i in example_generator(4)]) [0, 1, 2, 3]