quantization.fuse_known_modules

horizon_plugin_pytorch.quantization.fuse_known_modules (mod_list, is_qat=False, additional_fuser_method_mapping=None)

Fuse modules.

Return a list of modules that fuses the operations specified in the input module list.

Fuses only the following sequence of modules:

conv, bn;

conv, bn, relu;

conv, relu;

conv, bn, add;

conv, bn, add, relu;

conv, add;

conv, add, relu;

linear, bn;

linear, bn, relu;

linear, relu;

linear, bn, add;

linear, bn, add, relu;

linear, add;

linear, add, relu.

For these sequences, the first element in the output module list performs the fused operation. The rest of the elements are set to nn.Identity()