overrides
fastforward.overrides.override = forward_override
module-attribute
#
fastforward.overrides.DisableQuantizationOverride()
#
Override to disable quantization.
Attach DisableQuantizationOverride instance as quantizer override to
disable quantization. Quantization is enabled/disabled using the
enable_quantization and disable_quantization methods for all quantizers
the instance is attached to.
Quantizers can be 'bulk' attached to using the attach_to and detach
methods. Note that detach will only detach from quantizers which
where attached to using the attach_to methods, i.e., if an instance of
DisableQuantizationOverride is registered as override to a quantizers
using different means, it must be detached separately.
Source code in fastforward/overrides.py
77 78 79 | |
quantization_enabled
property
#
True if quantization is enabled, False otherwise.
__call__(_context, callback, args, kwargs)
#
Override function for quantizer disabling.
Source code in fastforward/overrides.py
107 108 109 110 111 112 113 114 115 116 117 118 | |
__repr__()
#
Source code in fastforward/overrides.py
120 121 122 | |
attach_to(quantizers)
#
Attach this override to one or more quantizers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quantizers
|
Quantizer | QuantizerCollection | Iterable[Quantizer]
|
Either a single quantizer, a |
required |
Source code in fastforward/overrides.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
detach()
#
Detach this override.
Detach from all quantizers it was attached to using the
attach_to method.
Source code in fastforward/overrides.py
144 145 146 147 148 149 150 151 152 | |
disable_quantization()
#
Disable quantization.
See the docstring of enable_quantization for more information.
Source code in fastforward/overrides.py
100 101 102 103 104 105 | |
enable_quantization(enabled=True)
#
Enable quantization.
More specifically, this instance will not disable quantization for any quantizers it is attached to. Other instance, or other methods may still disable quantization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
True if quantization must be enabled, False if it must be disabled. |
True
|
Source code in fastforward/overrides.py
86 87 88 89 90 91 92 93 94 95 96 97 98 | |
fastforward.overrides.disable_quantization(model)
#
Disable quantization for all quantizers in model within context.
The global strict_quantization flag is also set to False during the context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
The model for which all quantizers are disabled. |
required |
Source code in fastforward/overrides.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
fastforward.overrides.enable_quantization(model)
#
Enable quantization for all quantizers in model within context.
Note that this context manager does not change the strict_quantization flag.
To also (temporarily) change the strict_quantization flag use
fastforward.quantization.strict_quantization.strict_quantization_for_module
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
The model for which all quantizers are enabled. |
required |
Source code in fastforward/overrides.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |