neural_compressor.adaptor.torch_utils.waq.utils
Module Contents
Functions
|
Get module from model by key name. |
|
Set new module into model by key name. |
|
Move the input channel to the last dim |
|
Reshape the scale for input feature in channel |
|
Reshape the scale for weight input channel, depthwise output channel |
|
Class decorator to register a smoothquant auto-tune subclass. |
- neural_compressor.adaptor.torch_utils.waq.utils.get_module(model, key)[source]
Get module from model by key name.
- Parameters:
model (torch.nn.Module) – original model
key (str) – module name to be replaced
- neural_compressor.adaptor.torch_utils.waq.utils.set_module(model, key, new_module)[source]
Set new module into model by key name.
- Parameters:
model (torch.nn.Module) – original model
key (str) – module name to be replaced
new_module (torch.nn.Module) – new module to be inserted
- neural_compressor.adaptor.torch_utils.waq.utils.reshape_in_channel_to_last(layer_name, model)[source]
Move the input channel to the last dim :param layer_name: Layer name :return: The reshaped weight.
- neural_compressor.adaptor.torch_utils.waq.utils.reshape_scale_as_input(layer, scale)[source]
Reshape the scale for input feature in channel :param layer:
- Parameters:
scale –
- Returns: