Transformation - Streamline¶
Transformation (Streamline)¶
-
class
finn.transformation.streamline.
Streamline
¶ Bases:
finn.transformation.Transformation
Apply the streamlining transform, see arXiv:1709.04060.
-
apply
(model)¶
-
finn.transformation.streamline.absorb¶
-
class
finn.transformation.streamline.absorb.
Absorb1BitMulIntoMatMul
¶ Bases:
finn.transformation.Transformation
Absorb bipolar or binary multiplications into the preciding matrix multiply.
-
apply
(model)¶
-
-
class
finn.transformation.streamline.absorb.
AbsorbAddIntoMultiThreshold
¶ Bases:
finn.transformation.Transformation
Absorb preceding Add ops into MultiThreshold by updating the threshold values. Only scalar/1D add vectors can be absorbed.
-
apply
(model)¶
-
-
class
finn.transformation.streamline.absorb.
AbsorbMulIntoMultiThreshold
¶ Bases:
finn.transformation.Transformation
Absorb preceding Mul ops into MultiThreshold by updating the threshold values. Only positive scalar/1D mul vectors can be absorbed.
-
apply
(model)¶
-
-
class
finn.transformation.streamline.absorb.
FactorOutMulSignMagnitude
¶ Bases:
finn.transformation.Transformation
Split multiply-by-constant nodes into two multiply-by-constant nodes, where the first node is a bipolar vector (of signs) and the second is a vector of magnitudes.
-
apply
(model)¶
-
finn.transformation.streamline.collapse_repeated¶
-
class
finn.transformation.streamline.collapse_repeated.
CollapseRepeatedAdd
¶ Bases:
finn.transformation.streamline.collapse_repeated.CollapseRepeatedOp
Collapse repeated adder node into a single operation.
-
class
finn.transformation.streamline.collapse_repeated.
CollapseRepeatedMul
¶ Bases:
finn.transformation.streamline.collapse_repeated.CollapseRepeatedOp
Collapse repeated multiplier node into a single operation.
-
class
finn.transformation.streamline.collapse_repeated.
CollapseRepeatedOp
(op_name, make_collapsed_param_fxn)¶ Bases:
finn.transformation.Transformation
Collapse repeated consecutive operations with constant parameters into a single operation. make_collapsed_param_fxn must take two tensors and return a tensor which gives the equivalent result using a single op.
-
apply
(model)¶
-
finn.transformation.streamline.reorder¶
-
class
finn.transformation.streamline.reorder.
MoveAddPastMul
¶ Bases:
finn.transformation.Transformation
Move add operations past multiply operations. The aim is to have them next to each other such that they can be collapsed into a single add.
-
apply
(model)¶
-
-
class
finn.transformation.streamline.reorder.
MoveScalarAddPastMatMul
¶ Bases:
finn.transformation.Transformation
Move scalar add operations past matmul operations. We want to have adds next to each other such that they can be collapsed into a single add.
-
apply
(model)¶
-
-
class
finn.transformation.streamline.reorder.
MoveScalarMulPastMatMul
¶ Bases:
finn.transformation.Transformation
Move scalar mul operations past matmul operations. We want to have muls next to each other such that they can be collapsed into a single mul.
-
apply
(model)¶
-
finn.transformation.streamline.round_thresholds¶
-
class
finn.transformation.streamline.round_thresholds.
RoundAndClipThresholds
¶ Bases:
finn.transformation.Transformation
For MultiThreshold nodes operating on integer inputs, round up thresholds values to the nearest integer. Additionally, if the input is unsigned, sets negative thresholds to zero.
-
apply
(model)¶
-
finn.transformation.streamline.sign_to_thres¶
-
class
finn.transformation.streamline.sign_to_thres.
ConvertSignToThres
¶ Bases:
finn.transformation.Transformation
Convert Sign node instances to MultiThreshold with threshold at 0.
-
apply
(model)¶
-