Class ov::pass::BinarizeWeights#
-
class BinarizeWeights : public ov::pass::MatcherPass#
This transformation converts weights to -1/+1 form and applies normalization factors to output low/high and after Convolution. For example, following graph.
is transformed to:.... .... out_low out_high weights .. .. out_low out_high | | | | | | | | | +--------------------------+ +--------------------------+ | FakeQuantize (levels==2) | | FakeQuantize (levels==2) | | (on activations) | | (on weights) | +--------------------------+ +--------------------------+ | | | | ----------------- ------------------- | | v v +-------------+ | Convolution | +-------------+ | v
Normalization factors are chosen based output_high value. If it’s zero - norm factor is equal to output_low and output_high otherwisenormalized normalized .... .... out_low out_high | | | | +--------------------------+ +--------------------------+ | FakeQuantize (levels==2) | | Constant | | (on activations) | | (with converted weights) | +--------------------------+ +--------------------------+ | | | | ----------------- ------------------- | | v v +-------------+ | Convolution | +-------------+ | v +------------+ +---------------------------------------------------------------+ | Multiply | <---| Constant (normalization factor coming from FQ on activations) | +------------+ +---------------------------------------------------------------+ | v +------------+ +-----------------------------------------------------------+ | Multiply | <---| Constant (normalization factor coming from FQ on weights) | +------------+ +------------------------------------------------------------ | v