Skip to content

Commit

Permalink
[LPT] Add operation was added
Browse files Browse the repository at this point in the history
  • Loading branch information
eshoguli committed Sep 14, 2021
1 parent d623a2b commit 8514ba3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
# OpenVINO™ Low Precision Transformations: AddTransformation {#openvino_docs_IE_DG_lpt_AddTransformation}
# OpenVINO™ Low Precision Transformations: AddTransformation {#openvino_docs_IE_DG_lpt_AddTransformation}

The transformation propagates dequantization operations from one input branch to another and below `Add` operation. One or both branches can be quantized. As result, one `Add` operation input branch is in low precision without dequantization operations, another input branch is in original precision with updated dequantization operations.

During inference dequantization operations from another input will be fused in previous operation, for example in `Convolution` or `FakeQuantize`. This approach allows to infer `Add` operation in the most optimal way.

## Subgraph before transformation
The subgraph with quantized `Add` operation before transformation:

\f[
y_{ch,i}=(scale1_{ch} * (x1_{ch,i} - shift1_{ch})) + (scale2_{ch} * (x2_{ch,i} - shift2_{ch}))
\f]

![Add before](img/add.common.png)

## Subgraph after transformation
The subgraph with `Add` operation after the transformation:

\f[
y_{ch,i}=scale2_{ch} * (scale1_{ch}' * (x1_{ch,i} - shift1_{ch}') + x2_{ch,i})
\f]

where:

\f[
scale1_{ch}' = scale1_{ch} / scale2_{ch}
\f]

\f[
shift1_{ch}' = shift1_{ch} + scale2_{ch} * shift2_{ch} / scale1_{ch}
\f]

![Add before](img/add.transformed.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8514ba3

Please sign in to comment.