overrides
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
74 75 76 |
|
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
104 105 106 107 108 109 110 111 112 113 114 115 |
|
__repr__()
#
Source code in fastforward/overrides.py
117 118 119 |
|
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
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
detach()
#
Detach this override.
Detach from all quantizers it was attached to using the
attach_to
method.
Source code in fastforward/overrides.py
141 142 143 144 145 146 147 148 149 |
|
disable_quantization()
#
Disable quantization.
See the docstring of enable_quantization
for more information.
Source code in fastforward/overrides.py
97 98 99 100 101 102 |
|
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
83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
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
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
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
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|