API reference
Main API
auto_quantize(model, pretrained=True)
Turns a normal model into a quantized model, using an appropriate backend
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Any
|
The model to quantize. |
required |
pretrained |
bool
|
Whether this model is pretrained |
True
|
Source code in approx/core/api.py
auto_set_backend()
Automatically sets an appropriate backend for approx
to use.
Returns:
Type | Description |
---|---|
None
|
None. |
compare(model, quantized_model, test_loader, *, eval_loop)
Compares your normal model with your quantized model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Any
|
Your normal model |
required |
quantized_model |
Any
|
Your quantized model |
required |
test_loader |
Any
|
The "dataloader" to be used for testing. |
required |
eval_loop |
EvalLoop
|
Your evaluation loop that operates on your model and it's data, and returns a dictionary which maps each metric to its history |
required |
Returns:
Type | Description |
---|---|
CompareResult
|
Useful statistical information |
Source code in approx/core/api.py
Types
EvalLoop
A function which accepts your model and the data, and returns a dictionary mapping metrics to their histories.
For example